]> git.0d.be Git - empathy.git/commitdiff
Fix crash on hangup with no video
authorEmanuele Aina <emanuele.aina@collabora.com>
Wed, 14 Mar 2012 16:00:10 +0000 (17:00 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 16 Mar 2012 10:48:31 +0000 (11:48 +0100)
Insufficient refcount on priv->video_preview_sink caused segfaults
when accessing freed data.

https://bugzilla.gnome.org/show_bug.cgi?id=672063

src/empathy-call-window.c

index 565b9edcaf565a83302045bfd2901e15cefc428e..10333d6c305ba1736aaa0fda4caa1c572f0092af 100644 (file)
@@ -1082,9 +1082,9 @@ create_video_preview (EmpathyCallWindow *self)
 
   priv->video_preview_sink = gst_element_factory_make ("cluttersink", NULL);
   if (priv->video_preview_sink == NULL)
-    g_error ("Missing cluttersink");
-  else
-    g_object_set (priv->video_preview_sink, "texture", preview, NULL);
+      g_error ("Missing cluttersink, check your clutter-gst installation");
+  g_object_set (priv->video_preview_sink, "texture", preview, NULL);
+  g_object_add_weak_pointer (G_OBJECT (priv->video_preview_sink), (gpointer) &priv->video_preview_sink);
 
   /* Add a little offset to the video preview */
   layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
@@ -3626,7 +3626,8 @@ empathy_call_window_bus_message (GstBus *bus, GstMessage *message,
                   start_call (self);
               }
           }
-        if (GST_MESSAGE_SRC (message) == GST_OBJECT (priv->video_preview_sink))
+        if (priv->video_preview_sink != NULL &&
+            GST_MESSAGE_SRC (message) == GST_OBJECT (priv->video_preview_sink))
           {
             gst_message_parse_state_changed (message, NULL, &newstate,
                 &pending);