[gtk+/gtk-3-14] widget: Take a ref during ::unmap emission



commit 9fd9c4b0af04992a4f83574644ea1a790392ffcf
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Mar 16 13:45:03 2015 +0100

    widget: Take a ref during ::unmap emission
    
    This ensures the widget data stays live long enough to perform invariants
    check after emission if the widget happens to be destroyed on a callback.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745829

 gtk/gtkwidget.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index bb7783d..1850c59 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5072,6 +5072,7 @@ gtk_widget_unmap (GtkWidget *widget)
 
   if (gtk_widget_get_mapped (widget))
     {
+      g_object_ref (widget);
       gtk_widget_push_verify_invariants (widget);
 
       if (!gtk_widget_get_has_window (widget))
@@ -5084,6 +5085,7 @@ gtk_widget_unmap (GtkWidget *widget)
       g_signal_emit (widget, widget_signals[UNMAP], 0);
 
       gtk_widget_pop_verify_invariants (widget);
+      g_object_unref (widget);
     }
 }
 


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