mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
ext/gconf/gstgconfaudiosrc.*: Remove gconf notify hook when the gconfaudiosrc element is destroyed, otherwise the cal...
Original commit message from CVS: * 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.
This commit is contained in:
parent
14999998d4
commit
2f992c783e
3 changed files with 33 additions and 1 deletions
11
ChangeLog
11
ChangeLog
|
@ -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>
|
||||
|
|
|
@ -102,7 +102,7 @@ gst_gconf_audio_src_init (GstGConfAudioSrc * src,
|
|||
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 @@ gst_gconf_audio_src_dispose (GObject * object)
|
|||
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 @@ gst_gconf_audio_src_dispose (GObject * object)
|
|||
static gboolean
|
||||
do_toggle_element (GstGConfAudioSrc * src)
|
||||
{
|
||||
GstState cur, next;
|
||||
GstPad *targetpad;
|
||||
gchar *new_gconf_str;
|
||||
|
||||
|
@ -138,6 +144,19 @@ do_toggle_element (GstGConfAudioSrc * src)
|
|||
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;
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ typedef struct _GstGConfAudioSrc {
|
|||
GstElement *kid;
|
||||
GstPad *pad;
|
||||
|
||||
guint gconf_notify_id;
|
||||
|
||||
/* Current gconf string */
|
||||
gchar *gconf_str;
|
||||
} GstGConfAudioSrc;
|
||||
|
|
Loading…
Reference in a new issue