[gtk/wip/baedert/single-node-window: 11/11] window: ref() window before removing from toplevel list



commit 8cd4ce53085966495bde60f0270ddf59d898ac93
Author: Timm Bäder <mail baedert org>
Date:   Wed May 13 11:34:33 2020 +0200

    window: ref() window before removing from toplevel list
    
    The docs don't say but g_list_store_remove will unref() the item.
    
    Fixes #2741

 gtk/gtkwindow.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 6b904cb638..85c0241e44 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7297,12 +7297,15 @@ gtk_window_destroy (GtkWindow *window)
 
   gtk_tooltip_unset_surface (GTK_NATIVE (window));
 
+  g_object_ref (window);
+
   for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (toplevel_list)); i++)
     {
       gpointer item = g_list_model_get_item (G_LIST_MODEL (toplevel_list), i);
       if (item == window)
         {
           g_list_store_remove (toplevel_list, i);
+          g_object_unref (item);
           break;
         }
       else


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