diff options
author | Owen Taylor <otaylor@redhat.com> | 2004-02-13 03:03:21 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2004-02-13 03:03:21 +0000 |
commit | 3588aeb4af12621b16faeac0ccb3001ebe48f0e9 (patch) | |
tree | bbc61d29237642b0a6b459e3404828170f7f21b1 /gtk/gtkwidget.c | |
parent | e4d55e75e037452cc4ef7bfcdbae182d7f6a004d (diff) | |
download | gdk-pixbuf-3588aeb4af12621b16faeac0ccb3001ebe48f0e9.tar.gz |
Various reentrancy fixes for widgets being destroyed out of
Thu Feb 12 21:58:20 2004 Owen Taylor <otaylor@redhat.com>
Various reentrancy fixes for widgets being destroyed
out of focus-out-event. (#128821, Grant Gayed)
* gtk/gtkwindow.c (_gtk_window_unset_focus_and_default):
Ref window and widget over callbacks.
* gtk/gtkwidget.c (gtk_widget_hide)
gtk/gtkwidget.c (gtk_widget_set_child_visible):
Ref the widget before calling _gtk_window_unset_focus_and_default(),
since that can call user callbacks.
* gtk/gtkwidget.c (gtk_widget_invalidate_widget_windows):
Do nothing if the widget isn't realized.
Diffstat (limited to 'gtk/gtkwidget.c')
-rw-r--r-- | gtk/gtkwidget.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index f43e99434..874a3d136 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -2040,10 +2040,11 @@ gtk_widget_hide (GtkWidget *widget) if (GTK_WIDGET_VISIBLE (widget)) { GtkWidget *toplevel = gtk_widget_get_toplevel (widget); + + g_object_ref (widget); if (toplevel != widget && GTK_WIDGET_TOPLEVEL (toplevel)) _gtk_window_unset_focus_and_default (GTK_WINDOW (toplevel), widget); - g_object_ref (widget); g_signal_emit (widget, widget_signals[HIDE], 0); if (!GTK_WIDGET_TOPLEVEL (widget)) gtk_widget_queue_resize (widget); @@ -2613,6 +2614,9 @@ static void gtk_widget_invalidate_widget_windows (GtkWidget *widget, GdkRegion *region) { + if (!GTK_WIDGET_REALIZED (widget)) + return; + if (!GTK_WIDGET_NO_WINDOW (widget) && widget->parent) { int x, y; @@ -5114,6 +5118,8 @@ gtk_widget_set_child_visible (GtkWidget *widget, g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (!GTK_WIDGET_TOPLEVEL (widget)); + g_object_ref (widget); + if (is_visible) GTK_PRIVATE_SET_FLAG (widget, GTK_CHILD_VISIBLE); else @@ -5136,6 +5142,8 @@ gtk_widget_set_child_visible (GtkWidget *widget, else gtk_widget_unmap (widget); } + + g_object_unref (widget); } /** |