summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-05-10 12:26:22 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-05-10 22:04:35 -0400
commita0cae6957efad4ef0f04a0b96757382f3adca3a5 (patch)
treec9b07d0c3176a0bde8bf7a8cf3d38b2c517e0dae /modules
parentcb85a1fa3abfa4e9231aef6151bcf04419884559 (diff)
downloadgtk+-a0cae6957efad4ef0f04a0b96757382f3adca3a5.tar.gz
inspector: clean up better when objects go away
Instead of manually doing it everywhere, just call set_object (NULL) from the selection_changed handler. Fix all the set_object() functions to deal with NULL.
Diffstat (limited to 'modules')
-rw-r--r--modules/inspector/object-hierarchy.c3
-rw-r--r--modules/inspector/window.c28
2 files changed, 15 insertions, 16 deletions
diff --git a/modules/inspector/object-hierarchy.c b/modules/inspector/object-hierarchy.c
index 50ce6b2d58..6576a85024 100644
--- a/modules/inspector/object-hierarchy.c
+++ b/modules/inspector/object-hierarchy.c
@@ -73,6 +73,9 @@ gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
gtk_tree_store_clear (oh->priv->model);
+ if (object == NULL)
+ return;
+
interfaces = g_hash_table_new (g_str_hash, g_str_equal);
type = ((GTypeInstance*)object)->g_class->g_type;
diff --git a/modules/inspector/window.c b/modules/inspector/window.c
index 37363ef812..9434580bba 100644
--- a/modules/inspector/window.c
+++ b/modules/inspector/window.c
@@ -102,22 +102,18 @@ on_widget_tree_selection_changed (GtkInspectorWidgetTree *wt,
{
GObject *selected = gtk_inspector_widget_tree_get_selected_object (wt);
- if (selected != NULL)
- {
- if (!gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->prop_list), selected))
- return;
-
- gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->child_prop_list), selected);
- gtk_inspector_signals_list_set_object (GTK_INSPECTOR_SIGNALS_LIST (iw->signals_list), selected);
- gtk_inspector_object_hierarchy_set_object (GTK_INSPECTOR_OBJECT_HIERARCHY (iw->object_hierarchy), selected);
- gtk_inspector_button_path_set_object (GTK_INSPECTOR_BUTTON_PATH (iw->button_path), selected);
- gtk_inspector_classes_list_set_object (GTK_INSPECTOR_CLASSES_LIST (iw->classes_list), selected);
- gtk_inspector_css_editor_set_object (GTK_INSPECTOR_CSS_EDITOR (iw->widget_css_editor), selected);
- gtk_inspector_data_list_set_object (GTK_INSPECTOR_DATA_LIST (iw->data_list), selected);
-
- if (GTK_IS_WIDGET (selected))
- gtk_inspector_flash_widget (iw, GTK_WIDGET (selected));
- }
+ if (!gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->prop_list), selected))
+ return;
+
+ gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->child_prop_list), selected);
+ gtk_inspector_signals_list_set_object (GTK_INSPECTOR_SIGNALS_LIST (iw->signals_list), selected);
+ gtk_inspector_object_hierarchy_set_object (GTK_INSPECTOR_OBJECT_HIERARCHY (iw->object_hierarchy), selected);
+ gtk_inspector_button_path_set_object (GTK_INSPECTOR_BUTTON_PATH (iw->button_path), selected);
+ gtk_inspector_classes_list_set_object (GTK_INSPECTOR_CLASSES_LIST (iw->classes_list), selected);
+ gtk_inspector_css_editor_set_object (GTK_INSPECTOR_CSS_EDITOR (iw->widget_css_editor), selected);
+ gtk_inspector_data_list_set_object (GTK_INSPECTOR_DATA_LIST (iw->data_list), selected);
+ if (GTK_IS_WIDGET (selected))
+ gtk_inspector_flash_widget (iw, GTK_WIDGET (selected));
}
static void