Protect against recursion via gtk_container_remove(). (#459561, Christian

2007-07-23  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtktooltip.c (gtk_tooltip_set_custom): Protect against
        recursion via gtk_container_remove().  (#459561, Christian Persch)
        (gtk_tooltip_window_hide): Simplify.



svn path=/trunk/; revision=18534
This commit is contained in:
Matthias Clasen 2007-07-24 03:54:16 +00:00 committed by Matthias Clasen
parent ffcc8ddb95
commit 17aacf414d
2 changed files with 13 additions and 7 deletions

View File

@ -1,5 +1,9 @@
2007-07-23 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktooltip.c (gtk_tooltip_set_custom): Protect against
recursion via gtk_container_remove(). (#459561, Christian Persch)
(gtk_tooltip_window_hide): Simplify.
* tests/testtooltips.c: Add code to test gtk_tooltip_set_custom()
2007-07-23 Christian Persch <chpe@gnome.org>

View File

@ -314,9 +314,14 @@ gtk_tooltip_set_custom (GtkTooltip *tooltip,
if (tooltip->custom_widget)
{
gtk_container_remove (GTK_CONTAINER (tooltip->box),
tooltip->custom_widget);
g_object_unref (tooltip->custom_widget);
GtkWidget *custom = tooltip->custom_widget;
/* Note: We must reset tooltip->custom_widget first,
* since gtk_container_remove() will recurse into
* gtk_tooltip_set_custom()
*/
tooltip->custom_widget = NULL;
gtk_container_remove (GTK_CONTAINER (tooltip->box), custom);
g_object_unref (custom);
}
if (custom_widget)
@ -326,8 +331,6 @@ gtk_tooltip_set_custom (GtkTooltip *tooltip,
gtk_container_add (GTK_CONTAINER (tooltip->box), custom_widget);
gtk_widget_show (custom_widget);
}
else
tooltip->custom_widget = NULL;
}
/**
@ -427,8 +430,7 @@ gtk_tooltip_window_hide (GtkWidget *widget,
{
GtkTooltip *tooltip = GTK_TOOLTIP (user_data);
if (tooltip->custom_widget)
gtk_tooltip_set_custom (tooltip, NULL);
gtk_tooltip_set_custom (tooltip, NULL);
}
/* event handling, etc */