From f57395717260f8d0e3a8dcfb169612104ecb5f01 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 14 Jul 2012 18:22:48 +0200 Subject: [PATCH] [Rigo] avoid race with finally block and GC wrt file descriptors It has been observed that subprocess.call() called by open_url() might fail due to Error 9 (Bad File Descriptor) due to a race between the garbage collector thread (run in the MainThread) and our own subprocess.call() thread. For this reason, make sure to call open_url() outside the try/finally block. This seems to be enough. --- rigo/rigo/ui/gtk3/widgets/notifications.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rigo/rigo/ui/gtk3/widgets/notifications.py b/rigo/rigo/ui/gtk3/widgets/notifications.py index 5316e52bd..6b3294df3 100644 --- a/rigo/rigo/ui/gtk3/widgets/notifications.py +++ b/rigo/rigo/ui/gtk3/widgets/notifications.py @@ -561,7 +561,6 @@ class LicensesNotificationBox(NotificationBox): tmp_f.write("-" * 79 + "\n") tmp_f.write(license_text) tmp_f.flush() - open_url(tmp_path) else: const_debug_write( __name__, @@ -576,6 +575,9 @@ class LicensesNotificationBox(NotificationBox): pass # leaks, but xdg-open is async + if tmp_path is not None: + open_url(tmp_path) + def _on_license_activate(self, widget, uri): """ License link clicked.