After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 672063 - Crash on hangup in audio-only video call
Crash on hangup in audio-only video call
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: VoIP
3.3.x
Other Linux
: Normal critical
: ---
Assigned To: Emanuele Aina
empathy-maint
Depends on:
Blocks:
 
 
Reported: 2012-03-14 14:44 UTC by Emanuele Aina
Modified: 2012-03-16 10:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix crash on hangup with no video (1.35 KB, patch)
2012-03-14 16:08 UTC, Emanuele Aina
reviewed Details | Review
Added a comment for the video_preview_sink ownership and fixed (1.49 KB, patch)
2012-03-15 12:23 UTC, Emanuele Aina
none Details | Review
Take a weak ref to the sink and clean up when the pipeline is freed (2.12 KB, patch)
2012-03-15 17:04 UTC, Emanuele Aina
reviewed Details | Review
Fix crash on hangup with no video (1.75 KB, patch)
2012-03-16 10:38 UTC, Emanuele Aina
none Details | Review

Description Emanuele Aina 2012-03-14 14:44:51 UTC
- Kill empathy-call
- start a video call from another account
- click on the contact list
- accept the call but without video from the dialog
- hang up the call
- empathy crashes as priv->video_preview_sink is uninitialized and empathy_call_window_bus_message() is doing CAST on it
Comment 1 Emanuele Aina 2012-03-14 14:45:26 UTC


  • #0 g_type_check_instance_cast
    at /tmp/buildd/glib2.0-2.30.2/./gobject/gtype.c line 3993
  • #1 empathy_call_window_bus_message
    at empathy-call-window.c line 3622
  • #2 gst_bus_source_dispatch
    at gstbus.c line 764
  • #3 g_main_dispatch
    at /tmp/buildd/glib2.0-2.30.2/./glib/gmain.c line 2442
  • #4 g_main_context_dispatch
    at /tmp/buildd/glib2.0-2.30.2/./glib/gmain.c line 2998
  • #5 g_main_context_iterate
    at /tmp/buildd/glib2.0-2.30.2/./glib/gmain.c line 3076
  • #6 g_main_loop_run
    at /tmp/buildd/glib2.0-2.30.2/./glib/gmain.c line 3284
  • #7 gtk_main
    at /tmp/buildd/gtk+3.0-3.2.3/./gtk/gtkmain.c line 1362
  • #8 g_application_run
    at /tmp/buildd/glib2.0-2.30.2/./gio/gapplication.c line 1323
  • #9 main
    at empathy-call.c line 258

Comment 2 Emanuele Aina 2012-03-14 16:08:22 UTC
Created attachment 209747 [details] [review]
Fix crash on hangup with no video

Insufficient refcount on priv->video_preview_sink caused segfaults
when accessing freed data.
Comment 3 Guillaume Desmottes 2012-03-15 10:12:42 UTC
Review of attachment 209747 [details] [review]:

::: src/empathy-call-window.c
@@ +1085,3 @@
+    {
+      g_object_set (priv->video_preview_sink, "texture", preview, NULL);
+      gst_object_ref (priv->video_preview_sink);

Aren't we leaking this reference now?

But I don't understand, are we still creating the video preview in audio only calls? Where is the ref going away in audio call but not in video ones?

@@ +1090,2 @@
   else
+    g_error ("Missing cluttersink");

According to our coding style the if and else block have  to be consistent: if one is using { } then other one should too.
Comment 4 Emanuele Aina 2012-03-15 12:21:42 UTC
Review of attachment 209747 [details] [review]:

::: src/empathy-call-window.c
@@ +1085,3 @@
+    {
+      g_object_set (priv->video_preview_sink, "texture", preview, NULL);
+      gst_object_ref (priv->video_preview_sink);

I dont' think so, we take ownership of the object or empathy_call_window_reset_pipeline() will free the pipeline and leave us with garbled data.

For the viedo preview creation, we currently do not instatiate it if the window is created for an audio call, but if we do a video call the video preview is never disabled.
Comment 5 Emanuele Aina 2012-03-15 12:23:20 UTC
Created attachment 209819 [details] [review]
Added a comment for the video_preview_sink ownership and fixed

a coding style issue.
Comment 6 Guillaume Desmottes 2012-03-15 13:07:32 UTC
(In reply to comment #4)
> Review of attachment 209747 [details] [review]:
> 
> ::: src/empathy-call-window.c
> @@ +1085,3 @@
> +    {
> +      g_object_set (priv->video_preview_sink, "texture", preview, NULL);
> +      gst_object_ref (priv->video_preview_sink);
> 
> I dont' think so, we take ownership of the object or
> empathy_call_window_reset_pipeline() will free the pipeline and leave us with
> garbled data.

How I understand it (without your patch):
create_video_preview() creates the sink and add_video_preview_to_pipeline() passes the floating ref to the pipeline. So when the pipeline is destroyed the sink is destroyed as well.

But with your patch we take an extra ref which is never released -> leaked.

Wouldn't be it be cleaner to NULL the sink when the sink is destroyed and make empathy_call_window_bus_message() NULL-safe?

> For the viedo preview creation, we currently do not instatiate it if the window
> is created for an audio call, but if we do a video call the video preview is
> never disabled.

Right; so I think making this code NULL-safe is probably a good idea.
Comment 7 Emanuele Aina 2012-03-15 17:04:17 UTC
Created attachment 209862 [details] [review]
Take a weak ref to the sink and clean up when the pipeline is freed
Comment 8 Guillaume Desmottes 2012-03-16 10:12:57 UTC
Review of attachment 209862 [details] [review]:

::: src/empathy-call-window.c
@@ +1093,3 @@
+      g_error ("Missing cluttersink, check your clutter-gst installation");
+  g_object_set (priv->video_preview_sink, "texture", preview, NULL);
+  g_object_weak_ref (G_OBJECT (priv->video_preview_sink), remove_video_preview_sink, self);

Thanks, I prefer this approach. You can make it even simpler using g_object_add_weak_pointer().
Comment 9 Emanuele Aina 2012-03-16 10:38:17 UTC
Created attachment 209912 [details] [review]
Fix crash on hangup with no video

Patch simplified using g_object_add_weak_pointer
Comment 10 Guillaume Desmottes 2012-03-16 10:48:45 UTC
Attachment 209912 [details] pushed as 7b12eea - Fix crash on hangup with no video