rhythmbox r6240 - in trunk: . plugins/jamendo/jamendo plugins/rb



Author: jmatthew
Date: Fri Mar 20 14:09:31 2009
New Revision: 6240
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6240&view=rev

Log:
2009-03-21  Jonathan Matthew  <jonathan d14n org>

	* plugins/jamendo/jamendo/JamendoSource.py:
	* plugins/rb/Loader.py:
	Work around bug 575781 in the loader code rather than the code that
	calls it.


Modified:
   trunk/ChangeLog
   trunk/plugins/jamendo/jamendo/JamendoSource.py
   trunk/plugins/rb/Loader.py

Modified: trunk/plugins/jamendo/jamendo/JamendoSource.py
==============================================================================
--- trunk/plugins/jamendo/jamendo/JamendoSource.py	(original)
+++ trunk/plugins/jamendo/jamendo/JamendoSource.py	Fri Mar 20 14:09:31 2009
@@ -178,13 +178,7 @@
 			self.__updating = False
 			self.__saxHandler = None
 			self.__show_loading_screen (False)
-
-			# hack around bug 575781: if the catalogue loader is destroyed in this callback
-			# we'll crash, but afterwards is OK.
-			def done(self):
-				self.__catalogue_loader = None
-				return False
-			gobject.idle_add(done, self)
+			self.__catalogue_loader = None
 			return
 
 		self.__parser.feed(result)

Modified: trunk/plugins/rb/Loader.py
==============================================================================
--- trunk/plugins/rb/Loader.py	(original)
+++ trunk/plugins/rb/Loader.py	Fri Mar 20 14:09:31 2009
@@ -74,22 +74,30 @@
 		gtk.gdk.threads_leave()
 		return v
 
+	def _error_idle_cb(self, error):
+		self._callback_gdk(error)
+		return False
+
+	def _read_idle_cb(self, (stream, data)):
+		if (self._callback_gdk(data) is not False) and data:
+			stream.read_async (self.chunksize, self._read_cb, cancellable=self._cancel)
+		else:
+			# finished or cancelled by callback
+			stream.close()
+
+		return False
+
 	def _read_cb(self, stream, result):
 		try:
 			data = stream.read_finish(result)
 		except gio.Error, e:
 			print "error reading file %s: %s" % (self.uri, e.message)
 			stream.close()
-			self._callback_gdk(e)
+			gobject.idle_add(self._error_idle_cb, e)
+		
+		# this is mostly here to hack around bug 575781
+		gobject.idle_add(self._read_idle_cb, (stream, data))
 
-		if (self._callback_gdk(data) is not False) and data:
-			def again():
-				stream.read_async (self.chunksize, self._read_cb, cancellable=self._cancel)
-				return False
-			gobject.idle_add(again)
-		else:
-			# finished or cancelled by callback
-			stream.close()
 
 	def _open_cb(self, file, result):
 		try:



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