client: call weak-unref on client->sessions from finalize
authorLuca Ognibene <luca.ognibene@gmail.com>
Sun, 11 Oct 2009 11:57:54 +0000 (13:57 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Tue, 13 Oct 2009 08:57:35 +0000 (10:57 +0200)
Fixes bug #596305

gst/rtsp-server/rtsp-client.c

index 6dec049..050969d 100644 (file)
@@ -85,9 +85,17 @@ static void
 gst_rtsp_client_finalize (GObject * obj)
 {
   GstRTSPClient *client = GST_RTSP_CLIENT (obj);
+  GList *walk;
 
   g_message ("finalize client %p", client);
 
+  /* remove weak-ref from sessions */
+  for (walk = client->sessions; walk; walk = g_list_next (walk)) {
+    GstRTSPSession *msession = (GstRTSPSession *) walk->data;
+    g_object_weak_unref (G_OBJECT (msession),
+       (GWeakNotify) client_session_finalized, client);
+  }
+
   g_list_free (client->sessions);
 
   gst_rtsp_connection_free (client->connection);