[totem] backend: Fix crash on exit



commit 2250522b4b6b10e49737ded61668fb0bb2091590
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Mar 10 12:59:16 2015 +0100

    backend: Fix crash on exit
    
    When unrealizing the video widget, we weren't chaining up to the parent
    type. So GtkClutterOffscreen was left realized, and still attached to
    the clock frame, making it crash later when the clock frame tries to
    render another frame.

 src/backend/bacon-video-widget.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 3e1f7b8..b2ae6b6 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -641,8 +641,8 @@ bacon_video_widget_realize (GtkWidget * widget)
                    G_CALLBACK (leave_notify_cb), bvw);
 
   bvw->priv->missing_plugins_cancellable = g_cancellable_new ();
-  g_object_set_data (G_OBJECT (bvw), "missing-plugins-cancellable",
-                    bvw->priv->missing_plugins_cancellable);
+  g_object_set_data_full (G_OBJECT (bvw), "missing-plugins-cancellable",
+                         bvw->priv->missing_plugins_cancellable, g_object_unref);
   bacon_video_widget_gst_missing_plugins_setup (bvw);
 }
 
@@ -650,9 +650,21 @@ static void
 bacon_video_widget_unrealize (GtkWidget *widget)
 {
   BaconVideoWidget *bvw = BACON_VIDEO_WIDGET (widget);
+  GtkWidget *toplevel;
+
+  GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
+
+  gtk_widget_set_realized (widget, FALSE);
+
+  g_signal_handlers_disconnect_by_func (G_OBJECT (gtk_widget_get_screen (widget)),
+                                       size_changed_cb, bvw);
+  toplevel = gtk_widget_get_toplevel (widget);
+  g_signal_handlers_disconnect_by_func (G_OBJECT (toplevel),
+                                       leave_notify_cb, bvw);
 
   g_cancellable_cancel (bvw->priv->missing_plugins_cancellable);
-  g_clear_object (&bvw->priv->missing_plugins_cancellable);
+  bvw->priv->missing_plugins_cancellable = NULL;
+  g_object_set_data (G_OBJECT (bvw), "missing-plugins-cancellable", NULL);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]