client: Fix crash in close handler
authorBenjamin Berg <bberg@redhat.com>
Tue, 4 Dec 2018 13:12:04 +0000 (14:12 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 29 Jan 2019 18:34:08 +0000 (18:34 +0000)
The close handler could trigger a crash because it invalidated the
watch_context while still leaving a source attached to it which would be
cleaned up at a later point.

gst/rtsp-server/rtsp-client.c

index 70196a1..ce9cbce 100644 (file)
@@ -178,6 +178,8 @@ static void gst_rtsp_client_set_property (GObject * object, guint propid,
     const GValue * value, GParamSpec * pspec);
 static void gst_rtsp_client_finalize (GObject * obj);
 
+static void rtsp_ctrl_timeout_remove (GstRTSPClientPrivate * priv);
+
 static GstSDPMessage *create_sdp (GstRTSPClient * client, GstRTSPMedia * media);
 static gboolean handle_sdp (GstRTSPClient * client, GstRTSPContext * ctx,
     GstRTSPMedia * media, GstSDPMessage * sdp);
@@ -1229,6 +1231,7 @@ gst_rtsp_client_close (GstRTSPClient * client)
     g_source_destroy ((GSource *) priv->watch);
     priv->watch = NULL;
     gst_rtsp_client_set_send_func (client, NULL, NULL, NULL);
+    rtsp_ctrl_timeout_remove (priv);
     g_main_context_unref (priv->watch_context);
     priv->watch_context = NULL;
   }