Blob Blame History Raw
diff -Nur audacious-plugins-2.2-orig/src/streambrowser/gui/streambrowser_win.c audacious-plugins-2.2-streambrowser-race/src/streambrowser/gui/streambrowser_win.c
--- audacious-plugins-2.2-orig/src/streambrowser/gui/streambrowser_win.c	2009-11-22 23:49:53.000000000 +0100
+++ audacious-plugins-2.2-streambrowser-race/src/streambrowser/gui/streambrowser_win.c	2010-02-04 00:56:19.000000000 +0100
@@ -44,7 +44,7 @@
 static GtkWidget*		add_button;
 static GtkWidget*		bookmark_button;
 static GtkWidget*		streambrowser_window;
-static GList*			streamdir_gui_list;
+static GList*			streamdir_gui_list = NULL;
 static GtkCellRenderer*	cell_renderer_pixbuf;
 static GtkCellRenderer*	cell_renderer_text;
 
diff -Nur audacious-plugins-2.2-orig/src/streambrowser/streambrowser.c audacious-plugins-2.2-streambrowser-race/src/streambrowser/streambrowser.c
--- audacious-plugins-2.2-orig/src/streambrowser/streambrowser.c	2009-11-22 23:49:53.000000000 +0100
+++ audacious-plugins-2.2-streambrowser-race/src/streambrowser/streambrowser.c	2010-02-04 00:57:25.000000000 +0100
@@ -474,6 +474,20 @@
 
 	/* repetitively process the queue elements, until queue is empty */
 	while (data != NULL && g_queue_get_length(update_thread_data_queue) > 0) {
+        if (data->streamdir && !streamdir_is_valid(data->streamdir)) {
+            printf("WARNING: Skipping invalidated streambrowser queue element!\n");
+            g_free(data);
+            g_mutex_lock(update_thread_mutex);
+            /* remove the just processed data from the queue */
+            g_queue_pop_head(update_thread_data_queue);
+            /* try to get the last item in the queue */
+            if (g_queue_get_length(update_thread_data_queue) > 0)
+                data = g_queue_peek_head(update_thread_data_queue);
+            else
+                data = NULL;
+            g_mutex_unlock(update_thread_mutex);
+            continue;
+        }
 	    /* update a streaminfo */
 		if (data->streaminfo != NULL) {
 	    	gdk_threads_enter();
diff -Nur audacious-plugins-2.2-orig/src/streambrowser/streamdir.c audacious-plugins-2.2-streambrowser-race/src/streambrowser/streamdir.c
--- audacious-plugins-2.2-orig/src/streambrowser/streamdir.c	2009-11-22 23:49:53.000000000 +0100
+++ audacious-plugins-2.2-streambrowser-race/src/streambrowser/streamdir.c	2010-02-04 00:57:07.000000000 +0100
@@ -23,13 +23,19 @@
 #include "streambrowser.h"
 #include "streamdir.h"
 
+static GList *all_streamdirs = NULL;
+
+gboolean streamdir_is_valid(streamdir_t *streamdir) {
+    return (NULL != g_list_find(all_streamdirs,streamdir));
+}
 
 streamdir_t* streamdir_new(gchar *name)
 {
 	streamdir_t *streamdir = (streamdir_t*) g_malloc(sizeof(streamdir_t));
 	strncpy(streamdir->name, name, DEF_STRING_LEN);
 	streamdir->category_list = NULL;
-	
+
+    all_streamdirs = g_list_append(all_streamdirs,streamdir);
 	return streamdir;
 }
 
@@ -45,6 +51,8 @@
 
 	g_list_free(streamdir->category_list);
 	g_free(streamdir);
+
+    all_streamdirs = g_list_remove(all_streamdirs,streamdir);
 }
 
 
diff -Nur audacious-plugins-2.2-orig/src/streambrowser/streamdir.h audacious-plugins-2.2-streambrowser-race/src/streambrowser/streamdir.h
--- audacious-plugins-2.2-orig/src/streambrowser/streamdir.h	2009-11-22 23:49:53.000000000 +0100
+++ audacious-plugins-2.2-streambrowser-race/src/streambrowser/streamdir.h	2010-02-04 00:57:01.000000000 +0100
@@ -48,6 +48,7 @@
 
 } streamdir_t;
 
+gboolean streamdir_is_valid(streamdir_t *streamdir);
 
 streamdir_t*		streamdir_new(gchar *name);
 void				streamdir_delete(streamdir_t *streamdir);