forked from AuroraMiddleware/gtk
inspector: Clear overlays on unroot
In dispose(), we can't access the root anymore, since we're already unrooted. Fixes: #3265
This commit is contained in:
parent
e9eb385f25
commit
a39e519bed
@ -1069,13 +1069,11 @@ gtk_inspector_visual_constructed (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_inspector_visual_dispose (GObject *object)
|
gtk_inspector_visual_unroot (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkInspectorVisual *vis = GTK_INSPECTOR_VISUAL (object);
|
GtkInspectorVisual *vis = GTK_INSPECTOR_VISUAL (widget);
|
||||||
GtkInspectorWindow *iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_root (GTK_WIDGET (vis)));
|
GtkInspectorWindow *iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_root (GTK_WIDGET (vis)));
|
||||||
|
|
||||||
g_clear_pointer (&vis->swin, gtk_widget_unparent);
|
|
||||||
|
|
||||||
if (vis->layout_overlay)
|
if (vis->layout_overlay)
|
||||||
{
|
{
|
||||||
gtk_inspector_window_remove_overlay (iw, vis->layout_overlay);
|
gtk_inspector_window_remove_overlay (iw, vis->layout_overlay);
|
||||||
@ -1097,6 +1095,16 @@ gtk_inspector_visual_dispose (GObject *object)
|
|||||||
vis->focus_overlay = NULL;
|
vis->focus_overlay = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gtk_inspector_visual_parent_class)->unroot (widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_inspector_visual_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
GtkInspectorVisual *vis = GTK_INSPECTOR_VISUAL (object);
|
||||||
|
|
||||||
|
g_clear_pointer (&vis->swin, gtk_widget_unparent);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_inspector_visual_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gtk_inspector_visual_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1109,6 +1117,8 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
|
|||||||
object_class->constructed = gtk_inspector_visual_constructed;
|
object_class->constructed = gtk_inspector_visual_constructed;
|
||||||
object_class->dispose = gtk_inspector_visual_dispose;
|
object_class->dispose = gtk_inspector_visual_dispose;
|
||||||
|
|
||||||
|
widget_class->unroot = gtk_inspector_visual_unroot;
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/visual.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/visual.ui");
|
||||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, swin);
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, swin);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, box);
|
gtk_widget_class_bind_template_child (widget_class, GtkInspectorVisual, box);
|
||||||
|
Loading…
Reference in New Issue
Block a user