changeset 3360:8430c3911856 trunk

playlist_get_info_func works in a different thread, so trying to do UI updates from it eventually leads to UI freeze; fixed to schedule those updates in the main loop instead of doing them directly
author Giacomo Lozito <james@develia.org>
date Sat, 18 Aug 2007 00:31:51 +0200
parents 678ea77b6b1f
children e7d8727fb901
files src/audacious/playlist.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Fri Aug 17 18:52:46 2007 +0900
+++ b/src/audacious/playlist.c	Sat Aug 18 00:31:51 2007 +0200
@@ -2504,6 +2504,14 @@
     return result;
 }
 
+static gboolean
+playlist_request_win_update(gpointer unused)
+{
+    Playlist *playlist = playlist_get_active();
+    playlistwin_update_list(playlist);
+    return FALSE; /* to be called only once */
+}
+
 static gpointer
 playlist_get_info_func(gpointer arg)
 {
@@ -2600,7 +2608,9 @@
         }
 
         if (update_playlistwin) {
-            playlistwin_update_list(playlist);
+            /* we are in a different thread, so we can't do UI updates directly;
+               instead, schedule a playlist update in the main loop --giacomo */
+            g_idle_add_full(G_PRIORITY_HIGH_IDLE, playlist_request_win_update, NULL, NULL);
             update_playlistwin = FALSE;
         }