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