[gtk/mcatanzaro/company-unparent-warning] Add critical if widget has a parent during dispose
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/mcatanzaro/company-unparent-warning] Add critical if widget has a parent during dispose
- Date: Thu, 7 Jan 2021 15:50:23 +0000 (UTC)
commit d7144f248dfaebeb4f1af5f5b2b100878ccfc2da
Author: Benjamin Otte <otte redhat com>
Date: Thu Jan 7 09:49:52 2021 -0600
Add critical if widget has a parent during dispose
gtk/gtkwidget.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 239f7735e8..6efcdccc4a 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7187,7 +7187,13 @@ gtk_widget_dispose (GObject *object)
gtk_list_list_model_clear (priv->controller_observer);
if (priv->parent)
- gtk_widget_unparent (widget);
+ {
+ g_critical ("%s %p has a parent %s %p during dispose. Parents hold a reference, so this should not
happen.\n"
+ "Did you call g_object_unref() instead of gtk_widget_unparent()?",
+ G_OBJECT_TYPE_NAME (widget), widget,
+ G_OBJECT_TYPE_NAME (priv->parent), priv->parent);
+ priv->parent = NULL;
+ }
while (priv->paintables)
gtk_widget_paintable_set_widget (priv->paintables->data, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]