diff options
author | Sebastian Rasmussen <sebras@hotmail.com> | 2015-09-28 17:40:59 +0200 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2015-09-29 13:04:21 +0100 |
commit | be3e380d00185c4d1f0f652b0c5317b9e6183e4c (patch) | |
tree | d408a6ea41ff2f174e5b65f3320e3100da8d6052 | |
parent | 8a8bb37f8d6ad839a2a080677c8f2e0c71a3bc5a (diff) |
rtsp-media: Take reference to media that will be prepared
default_prepare() takes a transfer-none reference GstRTSPMedia object.
Later on a g_idle_source_new() is created and a pointer to the media
object is passed as user data. If the media is freed before the idle
source is dispatched the media object pointer is invalid, but the idle
source callback expects it to still be valid. To fix this a reference to
the media object is taken when registering the source callback function
and a corresponding release of the reference is done when the souce is
destroyed.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=755748
-rw-r--r-- | gst/rtsp-server/rtsp-media.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c index adccff9..5a6f758 100644 --- a/gst/rtsp-server/rtsp-media.c +++ b/gst/rtsp-server/rtsp-media.c @@ -2603,7 +2603,8 @@ default_prepare (GstRTSPMedia * media, GstRTSPThread * thread) /* do remainder in context */ source = g_idle_source_new (); - g_source_set_callback (source, (GSourceFunc) start_prepare, media, NULL); + g_source_set_callback (source, (GSourceFunc) start_prepare, + g_object_ref (media), (GDestroyNotify) g_object_unref); g_source_attach (source, context); g_source_unref (source); |