[Sugar-devel] [PATCH sugar-toolkit] fix regressions introduced by 29582de67f3189d232e170b1e07e9bf34233fb51

Sascha Silbe silbe at activitycentral.com
Thu Mar 3 08:42:50 EST 2011


GTK pops down the palette before it invokes the actions on the
menu item. We need to postpone destruction of the palette until
after all signals have propagated from the menu item to the
palette owner.

Signed-off-by: Sascha Silbe <silbe at activitycentral.com>
---

I don't really consider this a good solution (we now potentially race
with other idle tasks), but cannot come up with anything better. Of the
few existing idle_add calls that are related to palettes in some way
none accesses the palette in the idle task, so we should be safe for
now.

 src/sugar/graphics/palettewindow.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/sugar/graphics/palettewindow.py b/src/sugar/graphics/palettewindow.py
index ee9be96..026ee49 100644
--- a/src/sugar/graphics/palettewindow.py
+++ b/src/sugar/graphics/palettewindow.py
@@ -643,7 +643,12 @@ class Invoker(gobject.GObject):
         if self._palette is not None:
             self._palette.popdown(immediate=True)
             self._palette.props.invoker = None
-            self._palette.destroy()
+            # GTK pops down the palette before it invokes the actions on the
+            # menu item. We need to postpone destruction of the palette until
+            # after all signals have propagated from the menu item to the
+            # palette owner.
+            gobject.idle_add(lambda old_palette=self._palette:
+                             old_palette.destroy())

         self._palette = palette

--
1.7.2.3



More information about the Sugar-devel mailing list