changeset 3467:5a6896b6000f trunk

Implement playlist_get_info_scanning() with mutex locking.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 09 Sep 2007 21:36:42 +0300
parents 6ceb4439c6a0
children 440877c9360e
files src/audacious/playlist.c
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Sun Sep 09 18:47:56 2007 +0300
+++ b/src/audacious/playlist.c	Sun Sep 09 21:36:42 2007 +0300
@@ -2519,6 +2519,19 @@
 
 
 static gboolean
+playlist_get_info_scanning(void)
+{
+    gboolean result;
+
+    g_mutex_lock(mutex_scan);
+    result = playlist_get_info_scan_active;
+    g_mutex_unlock(mutex_scan);
+
+    return result;
+}
+
+
+static gboolean
 playlist_request_win_update(gpointer unused)
 {
     Playlist *playlist = playlist_get_active();
@@ -2539,7 +2552,7 @@
 
         // on_load
         if (cfg.use_pl_metadata && cfg.get_info_on_load &&
-            playlist_get_info_scan_active) {
+            playlist_get_info_scanning()) {
 
             for (node = playlist->entries; node; node = g_list_next(node)) {
                 entry = node->data;
@@ -2627,7 +2640,7 @@
             update_playlistwin = FALSE;
         }
 
-        if (playlist_get_info_scan_active) {
+        if (playlist_get_info_scanning()) {
             continue;
         }
 
@@ -3245,6 +3258,9 @@
 void
 playlist_free(Playlist *playlist)
 {
+    if (!playlist)
+        return;
+    
     g_mutex_free( playlist->mutex );
     g_free( playlist );
 }