From e9d1819fe390e6c6d2d664387922e28003da470e Mon Sep 17 00:00:00 2001 From: Josep Torra Valles Date: Sat, 31 Oct 2009 14:02:40 +0100 Subject: [PATCH] playbin: Make sure to keep a reference on the volume element Fixes null pointer dereferences under certain circumstances. Fixes bug #595401. --- gst/playback/gstplaybin.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gst/playback/gstplaybin.c b/gst/playback/gstplaybin.c index a505aa0..8d8ae29 100644 --- a/gst/playback/gstplaybin.c +++ b/gst/playback/gstplaybin.c @@ -1127,7 +1127,7 @@ gen_audio_element (GstPlayBin * play_bin) if (volume == NULL) goto no_volume; g_object_set (G_OBJECT (volume), "volume", play_bin->volume, NULL); - play_bin->volume_element = volume; + play_bin->volume_element = GST_ELEMENT_CAST (gst_object_ref (volume)); gst_bin_add (GST_BIN_CAST (element), volume); res = gst_element_link_pads (conv, "src", scale, "sink"); @@ -1442,6 +1442,11 @@ remove_sinks (GstPlayBin * play_bin) gst_object_unref (play_bin->textoverlay_element); play_bin->textoverlay_element = NULL; } + + if (play_bin->volume_element) { + gst_object_unref (play_bin->volume_element); + play_bin->volume_element = NULL; + } } /* loop over the streams and set up the pipeline to play this -- 2.7.4