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.
This commit is contained in:
Owen Taylor 2004-02-13 03:03:21 +00:00 committed by Owen Taylor
parent e4d55e75e0
commit 3588aeb4af
7 changed files with 95 additions and 1 deletions

View File

@ -1,3 +1,19 @@
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.
Fri Feb 13 01:31:44 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkbutton.c (_gtk_button_paint): Don't draw bevels around

View File

@ -1,3 +1,19 @@
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.
Fri Feb 13 01:31:44 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkbutton.c (_gtk_button_paint): Don't draw bevels around

View File

@ -1,3 +1,19 @@
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.
Fri Feb 13 01:31:44 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkbutton.c (_gtk_button_paint): Don't draw bevels around

View File

@ -1,3 +1,19 @@
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.
Fri Feb 13 01:31:44 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkbutton.c (_gtk_button_paint): Don't draw bevels around

View File

@ -1,3 +1,19 @@
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.
Fri Feb 13 01:31:44 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkbutton.c (_gtk_button_paint): Don't draw bevels around

View File

@ -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);
}
/**

View File

@ -4562,6 +4562,9 @@ _gtk_window_unset_focus_and_default (GtkWindow *window,
{
GtkWidget *child;
g_object_ref (window);
g_object_ref (widget);
if (GTK_CONTAINER (widget->parent)->focus_child == widget)
{
@ -4581,6 +4584,9 @@ _gtk_window_unset_focus_and_default (GtkWindow *window,
if (child == widget)
gtk_window_set_default (window, NULL);
g_object_unref (widget);
g_object_unref (window);
}
/*********************************