[rhythmbox] loader: ensure we always release the gdk lock after callbacks (bug #587691)



commit 1c74f1b047472bee1b11695cd3961584c4f5f5a8
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Jul 4 21:34:18 2009 +1000

    loader: ensure we always release the gdk lock after callbacks (bug #587691)

 plugins/rb/Loader.py |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/plugins/rb/Loader.py b/plugins/rb/Loader.py
index cacda7c..b1fa8f5 100644
--- a/plugins/rb/Loader.py
+++ b/plugins/rb/Loader.py
@@ -29,9 +29,14 @@ import gtk
 
 def callback_with_gdk_lock(callback, data, args):
 	gtk.gdk.threads_enter()
-	v = callback(data, *args)
-	gtk.gdk.threads_leave()
-	return v
+	try:
+		v = callback(data, *args)
+		gtk.gdk.threads_leave()
+		return v
+	except Exception, e:
+		print "Exception caught in loader callback: %s" % str(e)
+		gtk.gdk.threads_leave()
+		raise e
 
 
 class GioLoader(object):
@@ -70,9 +75,13 @@ class GioChunkLoader(object):
 
 	def _callback_gdk(self, result):
 		gtk.gdk.threads_enter()
-		v = self._callback(result)
-		gtk.gdk.threads_leave()
-		return v
+		try:
+			v = self._callback(result)
+			gtk.gdk.threads_leave()
+			return v
+		except Exception, e:
+			gtk.gdk.threads_leave()
+			raise e
 
 	def _error_idle_cb(self, error):
 		self._callback_gdk(error)
@@ -220,9 +229,13 @@ class GnomeVFSChunkLoader (object):
 
 	def _callback_gdk(self, result):
 		gtk.gdk.threads_enter()
-		v = self._callback(result)
-		gtk.gdk.threads_leave()
-		return v
+		try:
+			v = self._callback(result)
+			gtk.gdk.threads_leave()
+			return v
+		except Exception, e:
+			gtk.gdk.threads_leave()
+			raise e
 
 	def _read_cb (self, handle, buffer, exc_type, bytes_requested):
 		if exc_type:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]