From cfff5d819e861e22ee44b31a1252156de3043715 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Sat, 17 Oct 2015 02:40:50 +1100 Subject: [PATCH] gtk: separate out the widget/window destroy callbacks Fixes assertion due to the sink_finalize() being run before the widget destroy callback. https://bugzilla.gnome.org/show_bug.cgi?id=755969 --- ext/gtk/gstgtkbasesink.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ext/gtk/gstgtkbasesink.c b/ext/gtk/gstgtkbasesink.c index dd3af91016..e192940658 100644 --- a/ext/gtk/gstgtkbasesink.c +++ b/ext/gtk/gstgtkbasesink.c @@ -152,12 +152,15 @@ static void widget_destroy_cb (GtkWidget * widget, GstGtkBaseSink * gtk_sink) { GST_OBJECT_LOCK (gtk_sink); - if (widget == GTK_WIDGET (gtk_sink->widget)) - g_clear_object (>k_sink->widget); - else if (widget == gtk_sink->window) - gtk_sink->window = NULL; - else - g_assert_not_reached (); + g_clear_object (>k_sink->widget); + GST_OBJECT_UNLOCK (gtk_sink); +} + +static void +window_destroy_cb (GtkWidget * widget, GstGtkBaseSink * gtk_sink) +{ + GST_OBJECT_LOCK (gtk_sink); + gtk_sink->window = NULL; GST_OBJECT_UNLOCK (gtk_sink); } @@ -314,7 +317,7 @@ gst_gtk_base_sink_start_on_main (GstBaseSink * bsink) gtk_window_set_title (GTK_WINDOW (gst_sink->window), klass->window_title); gtk_container_add (GTK_CONTAINER (gst_sink->window), toplevel); g_signal_connect (gst_sink->window, "destroy", - G_CALLBACK (widget_destroy_cb), gst_sink); + G_CALLBACK (window_destroy_cb), gst_sink); } return TRUE;