[PATCH] Fix a deadlock when trying to add a keyboard layout (#862612).
Vratislav Podzimek
vpodzime at redhat.com
Fri Oct 5 16:22:48 UTC 2012
ACK. Thanks. However, I still don't get the reason why this method needs
the lock at all.
On Fri, 2012-10-05 at 12:08 -0400, Chris Lumens wrote:
> 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
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list