[PATCH] Fix a deadlock when trying to add a keyboard layout (#862612).

Chris Lumens clumens at redhat.com
Fri Oct 5 16:08:08 UTC 2012


This was introduced by 576349d2, which fixed a similar deadlock but accidentally
introduced this one.  Tweak that patch just a little to make sure the
gdk_threaded only gets applied when needed.
---
 pyanaconda/ui/gui/spokes/keyboard.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index c2e9b86..a64a63c 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -264,9 +264,8 @@ class KeyboardSpoke(NormalSpoke):
         dialog.refresh()
         dialog.initialize()
 
-        with gdk_threaded():
-            with enlightbox(self.window, dialog.window):
-                response = dialog.run()
+        with enlightbox(self.window, dialog.window):
+            response = dialog.run()
 
         if response == 1:
             duplicates = set()
@@ -284,6 +283,13 @@ class KeyboardSpoke(NormalSpoke):
                 self._removeLayout(self._store, itr)
                 self._remove_last_attempt = False
 
+    def _run_add_from_removed(self, button):
+        # Only call gdk_threaded when necessary (when we need to run the add
+        # dialog from the on_remove_clicked path) or we'll introduce a different
+        # deadlock.
+        with gdk_threaded():
+            self.on_add_clicked(button)
+
     def on_remove_clicked(self, button):
         selection = self.builder.get_object("layoutSelection")
         if not selection.count_selected_rows():
@@ -304,7 +310,7 @@ class KeyboardSpoke(NormalSpoke):
             #redrawn
             self._remove_last_attempt = True
             add_button = self.builder.get_object("addLayoutButton")
-            GLib.idle_add(self.on_add_clicked, add_button)
+            GLib.idle_add(self._run_add_from_removed, add_button)
             return
 
         #the selected item is not the first, select the previous one
-- 
1.7.11.2



More information about the anaconda-patches mailing list