changeset 4585:78e21c07ba6a

branch merge
author Tomasz Mon <desowin@gmail.com>
date Thu, 22 May 2008 19:30:02 +0200
parents 41400d8a5dc9 (current diff) 77f57ba8d7a4 (diff)
children 5fa09aa0b14a
files src/audacious/ui_main_evlisteners.c
diffstat 6 files changed, 26 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/acinclude.m4	Thu May 22 19:29:46 2008 +0200
+++ b/acinclude.m4	Thu May 22 19:30:02 2008 +0200
@@ -167,6 +167,6 @@
 
 dnl Check for libmcs
 dnl ================
-AUD_CHECK_MODULE([LIBMCS], [libmcs >= 0.7], [libmcs],
+AUD_CHECK_MODULE([LIBMCS], [libmcs], [>= 0.7], [libmcs],
     [http://www.atheme.org/projects/mcs.shtml])
 ])
--- a/src/audacious/eventqueue.c	Thu May 22 19:29:46 2008 +0200
+++ b/src/audacious/eventqueue.c	Thu May 22 19:30:02 2008 +0200
@@ -27,6 +27,9 @@
     hook_call(hq->name, hq->user_data);
 
     g_free(hq->name);
+    if (hq->free_data && hq->user_data)
+        g_free(hq->user_data);
+
     g_slice_free(HookCallQueue, hq);
 
     return FALSE;
@@ -42,6 +45,7 @@
     hq = g_slice_new0(HookCallQueue);
     hq->name = g_strdup(name);
     hq->user_data = user_data;
+    hq->free_data = FALSE;
 
     g_idle_add_full(G_PRIORITY_HIGH_IDLE, eventqueue_handle, hq, NULL);
 }
@@ -56,6 +60,22 @@
     hq = g_slice_new0(HookCallQueue);
     hq->name = g_strdup(name);
     hq->user_data = user_data;
+    hq->free_data = FALSE;
 
     g_timeout_add(time, eventqueue_handle, hq);
 }
+
+void event_queue_with_data_free(const gchar *name, gpointer user_data)
+{
+    HookCallQueue *hq;
+
+    g_return_if_fail(name != NULL);
+    g_return_if_fail(user_data != NULL);
+
+    hq = g_slice_new0(HookCallQueue);
+    hq->name = g_strdup(name);
+    hq->user_data = user_data;
+    hq->free_data = TRUE;
+
+    g_idle_add_full(G_PRIORITY_HIGH_IDLE, eventqueue_handle, hq, NULL);
+}
\ No newline at end of file
--- a/src/audacious/eventqueue.h	Thu May 22 19:29:46 2008 +0200
+++ b/src/audacious/eventqueue.h	Thu May 22 19:30:02 2008 +0200
@@ -28,9 +28,11 @@
 typedef struct {
     gchar *name;
     gpointer *user_data;
+    gboolean free_data;
 } HookCallQueue;
 
 void event_queue(const gchar *name, gpointer user_data);
 void event_queue_timed(gint time, const gchar *name, gpointer user_data);
+void event_queue_with_data_free(const gchar *name, gpointer user_data);
 
 #endif /* AUDACIOUS_EVENTQUEUE_H */
--- a/src/audacious/input.c	Thu May 22 19:29:46 2008 +0200
+++ b/src/audacious/input.c	Thu May 22 19:30:02 2008 +0200
@@ -781,5 +781,5 @@
 input_set_info_text(gchar *text)
 {
     gchar *title = g_strdup(text);
-    event_queue("title change", title);
+    event_queue_with_data_free("title change", title);
 }
--- a/src/audacious/playlist.c	Thu May 22 19:29:46 2008 +0200
+++ b/src/audacious/playlist.c	Thu May 22 19:30:02 2008 +0200
@@ -1109,10 +1109,10 @@
     msg->channels = nch;
 
     playback_set_sample_params(rate, freq, nch);
-    event_queue("playlist info change", msg);
+    event_queue_with_data_free("playlist info change", msg);
 
     text = playlist_get_info_text(playlist);
-    event_queue("title change", text);
+    event_queue_with_data_free("title change", text);
 
     if ( playlist->position )
         hook_call( "playlist set info" , playlist->position );
--- a/src/audacious/ui_main_evlisteners.c	Thu May 22 19:29:46 2008 +0200
+++ b/src/audacious/ui_main_evlisteners.c	Thu May 22 19:30:02 2008 +0200
@@ -63,7 +63,6 @@
 
     ui_skinned_textbox_set_text(mainwin_info, text);
     playlistwin_update_list(playlist_get_active());
-    g_free(text);
 }
 
 static void
@@ -193,8 +192,6 @@
     PlaylistEventInfoChange *msg = (PlaylistEventInfoChange *) hook_data;
 
     mainwin_set_song_info(msg->bitrate, msg->samplerate, msg->channels);
-
-    g_free(msg);
 }
 
 static void