commit e93fd2d7afe1411a5a60052a4adecd6a56db5b7b
Author: Jonathan Matthew <jonathan@d14n.org>
Date: Fri Nov 27 07:14:51 2009 +1000
context: use an idle handler for track changes (bug #602140)
The playing-song-changed signal is sometimes emitted on a streaming
thread. Calling into webkit on non-main threads causes it to crash
pretty reliably, so we need to use an idle handler to process it on the
main thread.
diff --git a/plugins/context/context/ContextView.py b/plugins/context/context/ContextView.py
index 7e2c0d6..e204fc4 100644
--- a/plugins/context/context/ContextView.py
+++ b/plugins/context/context/ContextView.py
@@ -174,6 +174,14 @@ class ContextView (gobject.GObject):
self.top_five_list[(i,)] = ("%d. " % (i+1), track)
def playing_changed_cb (self, playing, user_data):
+ # this sometimes happens on a streaming thread, so we need to
+ # move it to the main thread
+ gobject.idle_add (self.playing_changed_idle_cb)
+
+ def playing_changed_idle_cb (self):
+ if self.sp is None:
+ return
+
playing_entry = self.sp.get_playing_entry ()
if playing_entry is None:
return