inspector: Dispose the recorder properly

We were leaking children here.
This commit is contained in:
Matthias Clasen 2020-07-17 22:44:01 -04:00
parent cb906c80eb
commit 9ffd7d1970
2 changed files with 4 additions and 1 deletions

View File

@ -61,6 +61,7 @@ struct _GtkInspectorRecorder
GListStore *render_node_root_model; GListStore *render_node_root_model;
GtkSingleSelection *render_node_selection; GtkSingleSelection *render_node_selection;
GtkWidget *box;
GtkWidget *recordings_list; GtkWidget *recordings_list;
GtkWidget *render_node_view; GtkWidget *render_node_view;
GtkWidget *render_node_list; GtkWidget *render_node_list;
@ -1168,6 +1169,7 @@ gtk_inspector_recorder_dispose (GObject *object)
{ {
GtkInspectorRecorder *recorder = GTK_INSPECTOR_RECORDER (object); GtkInspectorRecorder *recorder = GTK_INSPECTOR_RECORDER (object);
g_clear_pointer (&recorder->box, gtk_widget_unparent);
g_clear_object (&recorder->render_node_model); g_clear_object (&recorder->render_node_model);
g_clear_object (&recorder->render_node_root_model); g_clear_object (&recorder->render_node_root_model);
g_clear_object (&recorder->render_node_selection); g_clear_object (&recorder->render_node_selection);
@ -1202,6 +1204,7 @@ gtk_inspector_recorder_class_init (GtkInspectorRecorderClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/recorder.ui"); gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/recorder.ui");
gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, recordings); gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, recordings);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, recordings_list); gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, recordings_list);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, render_node_view); gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, render_node_view);

View File

@ -2,7 +2,7 @@
<object class="GListStore" id="recordings"/> <object class="GListStore" id="recordings"/>
<template class="GtkInspectorRecorder" parent="GtkWidget"> <template class="GtkInspectorRecorder" parent="GtkWidget">
<child> <child>
<object class="GtkBox"> <object class="GtkBox" id="box">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">