From: <tp...@ke...> - 2006-12-11 11:41:35
|
CVS Root: /cvs/gstreamer Module: gst-plugins-good Changes by: tpm Date: Mon Dec 11 2006 11:41:30 UTC Log message: * ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_init), (gst_gconf_audio_src_dispose), (do_toggle_element): * ext/gconf/gstgconfaudiosrc.h: Remove gconf notify hook when the gconfaudiosrc element is destroyed, otherwise the callback may be called on an already-destroyed instance and bad things happen. Should fix #378184. Also ignore gconf key changes when the source is already running. Modified files: . : ChangeLog ext/gconf : gstgconfaudiosrc.c gstgconfaudiosrc.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ChangeLog.diff?r1=1.2656&r2=1.2657 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ext/gconf/gstgconfaudiosrc.c.diff?r1=1.4&r2=1.5 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ext/gconf/gstgconfaudiosrc.h.diff?r1=1.3&r2=1.4 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-good/ChangeLog,v retrieving revision 1.2656 retrieving revision 1.2657 diff -u -d -r1.2656 -r1.2657 --- ChangeLog 9 Dec 2006 19:27:28 -0000 1.2656 +++ ChangeLog 11 Dec 2006 11:41:18 -0000 1.2657 @@ -1,3 +1,14 @@ +2006-12-11 Tim-Philipp Müller <tim at centricular dot net> + + * ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_init), + (gst_gconf_audio_src_dispose), (do_toggle_element): + * ext/gconf/gstgconfaudiosrc.h: + Remove gconf notify hook when the gconfaudiosrc element is + destroyed, otherwise the callback may be called on an + already-destroyed instance and bad things happen. Should fix + #378184. + Also ignore gconf key changes when the source is already running. 2006-12-09 Tim-Philipp Müller <tim at centricular dot net> Patch by: Sebastian Dröge <mail at slomosnail de> Index: gstgconfaudiosrc.c RCS file: /cvs/gstreamer/gst-plugins-good/ext/gconf/gstgconfaudiosrc.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- gstgconfaudiosrc.c 25 Apr 2006 21:39:41 -0000 1.4 +++ gstgconfaudiosrc.c 11 Dec 2006 11:41:18 -0000 1.5 @@ -102,7 +102,7 @@ src->client = gconf_client_get_default (); gconf_client_add_dir (src->client, GST_GCONF_DIR, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); - gconf_client_notify_add (src->client, + src->gconf_notify_id = gconf_client_notify_add (src->client, GST_GCONF_DIR "/" GST_GCONF_AUDIOSRC_KEY, cb_toggle_element, src, NULL, NULL); } @@ -113,6 +113,11 @@ GstGConfAudioSrc *src = GST_GCONF_AUDIO_SRC (object); if (src->client) { + if (src->gconf_notify_id) { + gconf_client_notify_remove (src->client, src->gconf_notify_id); + src->gconf_notify_id = 0; + } g_object_unref (G_OBJECT (src->client)); src->client = NULL; } @@ -126,6 +131,7 @@ static gboolean do_toggle_element (GstGConfAudioSrc * src) { + GstState cur, next; GstPad *targetpad; gchar *new_gconf_str; @@ -138,6 +144,19 @@ return TRUE; + GST_OBJECT_LOCK (src); + cur = GST_STATE (src); + next = GST_STATE_PENDING (src); + GST_OBJECT_UNLOCK (src); + if (cur >= GST_STATE_READY || next == GST_STATE_PAUSED) { + GST_DEBUG_OBJECT (src, "already running, ignoring GConf change"); + return TRUE; + } + GST_DEBUG_OBJECT (src, "GConf key changed: '%s' to '%s'", + GST_STR_NULL (src->gconf_str), GST_STR_NULL (new_gconf_str)); g_free (src->gconf_str); src->gconf_str = new_gconf_str; Index: gstgconfaudiosrc.h RCS file: /cvs/gstreamer/gst-plugins-good/ext/gconf/gstgconfaudiosrc.h,v retrieving revision 1.3 diff -u -d -r1.3 -r1.4 --- gstgconfaudiosrc.h 1 Jun 2006 21:07:23 -0000 1.3 +++ gstgconfaudiosrc.h 11 Dec 2006 11:41:18 -0000 1.4 @@ -40,6 +40,8 @@ GstElement *kid; GstPad *pad; + guint gconf_notify_id; /* Current gconf string */ gchar *gconf_str; } GstGConfAudioSrc; |