diff --git a/gui/commands.py b/gui/commands.py index 3048ce5..2cb6451 100644 --- a/gui/commands.py +++ b/gui/commands.py @@ -41,8 +41,7 @@ class GuiSourceCommand(gdb.Command): def invoke(self, arg, from_tty): self.dont_repeat() - gui.startup.start_gtk() - gui.startup.send_to_gtk(gui.source.SourceWindow) + gui.source.SourceWindow() class GuiLogWindowCommand(gdb.Command): """Create a new log window. @@ -63,7 +62,6 @@ class GuiLogWindowCommand(gdb.Command): def invoke(self, arg, from_tty): self.dont_repeat() - gui.startup.start_gtk() window = gui.logwindow.LogWindow() print "Created log window %d; now the default" % window.number @@ -136,8 +134,6 @@ class GuiDisplayCommand(gdb.Command): def invoke(self, arg, from_tty): self.dont_repeat() - # FIXME: perhaps Toplevel should be calling startup_gtk - gui.startup.start_gtk() gui.display.DisplayWindow(arg) def complete(self, text, word): diff --git a/gui/source.py b/gui/source.py index 8d04949..073ea00 100644 --- a/gui/source.py +++ b/gui/source.py @@ -176,7 +176,10 @@ class SourceWindow(Toplevel): def __init__(self): super(SourceWindow, self).__init__() + gui.startup.send_to_gtk(self._initialize) + @in_gtk_thread + def _initialize(self): self.frame = None self.do_step = Invoker("step") diff --git a/gui/toplevel.py b/gui/toplevel.py index 45064f0..e7116ab 100644 --- a/gui/toplevel.py +++ b/gui/toplevel.py @@ -21,6 +21,7 @@ import threading class _ToplevelState(object): def __init__(self): + gui.startup.start_gtk() # This lock must be held when using the other globals here. self.toplevel_lock = threading.Lock() self.next_toplevel = 1