From 0cd0ef2d26736c7ba0eadb00cb446d2b31c1f699 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 9 May 2020 19:27:05 -0400 Subject: [PATCH] widget: Don't leak a reference when reordering When reordering a widget that is alrady under the same parent, we must not take another reference. --- gtk/gtkwidget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 167d9a15ab..15c775aa44 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -5824,7 +5824,8 @@ gtk_widget_reposition_after (GtkWidget *widget, /* keep this function in sync with gtk_menu_attach_to_widget() */ - g_object_ref_sink (widget); + if (priv->parent == NULL) + g_object_ref_sink (widget); gtk_widget_push_verify_invariants (widget);