From dbb0375bfef196f7df7b22da6e18422a2dd3250b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 28 Apr 2017 17:12:25 +0200 Subject: [PATCH] playback/player: don't unref a contained widget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the GTK+ model, when a wiget is created, it is floating, thus when it is added to a widget container, this container is the owner of the widget. The video_area widget is created in two different paths: 1\ when the renderer element is also a GTK+ widget and we are the owners. 2\ when the renderer element is an overlay an video area a new widget owned by the container. In the first code path, there was a memory leak fixed on commit f8d4796a, but it didn't consider the second path, leading to a segmentation fault because the owner of the widget is not us. This patch unrefs early the video area widget in the first path avoiding to unref it twice in the second path. https://bugzilla.gnome.org/show_bug.cgi?id=781904 --- playback/player/gtk/gtk-play.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playback/player/gtk/gtk-play.c b/playback/player/gtk/gtk-play.c index 8ae0fea01c..c961198c8a 100644 --- a/playback/player/gtk/gtk-play.c +++ b/playback/player/gtk/gtk-play.c @@ -1425,6 +1425,7 @@ create_ui (GtkPlay * play) play->video_area = gst_player_gtk_video_renderer_get_widget (GST_PLAYER_GTK_VIDEO_RENDERER (play->renderer)); + g_object_unref (play->video_area); } else { play->renderer = gst_player_video_overlay_video_renderer_new (NULL); @@ -1778,7 +1779,6 @@ gtk_play_dispose (GObject * object) g_object_unref (self->player); } self->player = NULL; - g_clear_object (&self->video_area); G_OBJECT_CLASS (gtk_play_parent_class)->dispose (object); }