gtk: Fix "children left" warning with fatal warnings
When fatal warnings were turned on, the developer would never see which widgets were left as children to the widget that triggered the warning as those were printed in separate g_warning calls. Print a single warning with all the info so runs with fatal warnings aren't left without any info.
This commit is contained in:
@@ -7637,14 +7637,20 @@ gtk_widget_finalize (GObject *object)
|
|||||||
if (_gtk_widget_get_first_child (widget) != NULL)
|
if (_gtk_widget_get_first_child (widget) != NULL)
|
||||||
{
|
{
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
g_warning ("Finalizing %s %p, but it still has children left:",
|
GString *s;
|
||||||
gtk_widget_get_name (widget), widget);
|
|
||||||
|
s = g_string_new (NULL);
|
||||||
|
g_string_append_printf (s, "Finalizing %s %p, but it still has children left:",
|
||||||
|
gtk_widget_get_name (widget), widget);
|
||||||
for (child = _gtk_widget_get_first_child (widget);
|
for (child = _gtk_widget_get_first_child (widget);
|
||||||
child != NULL;
|
child != NULL;
|
||||||
child = _gtk_widget_get_next_sibling (child))
|
child = _gtk_widget_get_next_sibling (child))
|
||||||
{
|
{
|
||||||
g_warning (" - %s %p", gtk_widget_get_name (child), child);
|
g_string_append_printf (s, "\n - %s %p",
|
||||||
|
gtk_widget_get_name (child), child);
|
||||||
}
|
}
|
||||||
|
g_warning ("%s", s->str);
|
||||||
|
g_string_free (s, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_object_is_floating (object))
|
if (g_object_is_floating (object))
|
||||||
|
|||||||
Reference in New Issue
Block a user