inspector: Clean up on finalize

Just a matter of cleanliness.
This commit is contained in:
Matthias Clasen 2019-04-06 15:46:14 +00:00
parent 5ff59c12b0
commit c31185b419

View File

@ -918,6 +918,22 @@ gtk_inspector_visual_constructed (GObject *object)
g_signal_connect (vis->priv->gl_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
}
static void
gtk_inspector_visual_finalize (GObject *object)
{
GtkInspectorVisual *vis = GTK_INSPECTOR_VISUAL (object);
GtkInspectorWindow *iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (vis)));
if (vis->priv->layout_overlay)
gtk_inspector_window_remove_overlay (iw, vis->priv->layout_overlay);
if (vis->priv->updates_overlay)
gtk_inspector_window_remove_overlay (iw, vis->priv->updates_overlay);
if (vis->priv->fps_overlay)
gtk_inspector_window_remove_overlay (iw, vis->priv->fps_overlay);
G_OBJECT_CLASS (gtk_inspector_visual_parent_class)->finalize (object);
}
static void
gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
{
@ -925,6 +941,7 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = gtk_inspector_visual_constructed;
object_class->finalize = gtk_inspector_visual_finalize;
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/visual.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, direction_combo);