diff options
author | Miloslav Trmac <mitr@redhat.com> | 2009-07-14 16:34:15 +0200 |
---|---|---|
committer | Martin Sivak <msivak@redhat.com> | 2009-07-14 16:34:15 +0200 |
commit | 42ca0f13ebcf08ed732078442f95f82558f2eb39 (patch) | |
tree | 4ee36b4163214d1b77b38940e919773b1cdaec70 /frontend/frontend_gtk.py | |
parent | c87d413a14e96c5415fce008a5a3d2a94256326f (diff) | |
download | firstaidkit-42ca0f13ebcf08ed732078442f95f82558f2eb39.tar.gz firstaidkit-42ca0f13ebcf08ed732078442f95f82558f2eb39.tar.xz firstaidkit-42ca0f13ebcf08ed732078442f95f82558f2eb39.zip |
Add GDK locking around callbacks
Diffstat (limited to 'frontend/frontend_gtk.py')
-rw-r--r-- | frontend/frontend_gtk.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/frontend/frontend_gtk.py b/frontend/frontend_gtk.py index fd3c91b..0a30749 100644 --- a/frontend/frontend_gtk.py +++ b/frontend/frontend_gtk.py @@ -46,9 +46,13 @@ class CallbacksMainWindow(object): def _o(pages, stopbutton): """Always return False -> remove from the idle queue after first execution""" - for i in range(pages.get_n_pages()): - pages.get_nth_page(i).set_sensitive(True) - stopbutton.set_sensitive(False) + gtk.gdk.threads_enter() + try: + for i in range(pages.get_n_pages()): + pages.get_nth_page(i).set_sensitive(True) + stopbutton.set_sensitive(False) + finally: + gtk.gdk.threads_leave() return False def worker(*args): @@ -537,7 +541,11 @@ class MainWindow(object): def _o(func, *args, **kwargs): """Always return False -> remove from the idle queue after first execution""" - func(*args, **kwargs) + try: + gtk.gdk.threads_enter() + func(*args, **kwargs) + finally: + gtk.gdk.threads_leave() return False def issue_state(self): |