diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2023-03-03 19:07:16 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2023-03-03 22:07:09 +0000 |
commit | 500128d186a7a3bb86ba9af8e5151e8335fe90da (patch) | |
tree | e77ce7377fef5d9759c2aee11b148ec2fc58c544 /gtk/inspector | |
parent | 9b98426e716042aa4ed0a7891b99d9898acd6178 (diff) | |
download | gtk+-500128d186a7a3bb86ba9af8e5151e8335fe90da.tar.gz |
a11y: Plug reference leaks
The gtk_accessible_get_at_context() getter is now transfer full, which
means we need to drop the reference when getting the GtkATContext.
Diffstat (limited to 'gtk/inspector')
-rw-r--r-- | gtk/inspector/a11y.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/gtk/inspector/a11y.c b/gtk/inspector/a11y.c index f184489204..7fbaec0c92 100644 --- a/gtk/inspector/a11y.c +++ b/gtk/inspector/a11y.c @@ -244,6 +244,8 @@ update_path (GtkInspectorA11y *sl) } else path = "not on bus"; + + g_clear_object (&context); #endif gtk_label_set_label (GTK_LABEL (sl->path), path); @@ -270,7 +272,7 @@ update_attributes (GtkInspectorA11y *sl) gboolean has_value; context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object)); - if (!context) + if (context == NULL) return; store = g_list_store_new (G_TYPE_OBJECT); @@ -347,6 +349,8 @@ update_attributes (GtkInspectorA11y *sl) g_object_unref (selection); gtk_widget_set_visible (sl->attributes, g_list_model_get_n_items (G_LIST_MODEL (filter_model)) > 0); + + g_object_unref (context); } static void @@ -420,8 +424,11 @@ gtk_inspector_a11y_set_object (GtkInspectorA11y *sl, if (sl->object && GTK_IS_ACCESSIBLE (sl->object)) { context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object)); - if (context) - g_signal_handlers_disconnect_by_func (context, refresh_all, sl); + if (context != NULL) + { + g_signal_handlers_disconnect_by_func (context, refresh_all, sl); + g_object_unref (context); + } } g_set_object (&sl->object, object); @@ -432,8 +439,12 @@ gtk_inspector_a11y_set_object (GtkInspectorA11y *sl, if (GTK_IS_ACCESSIBLE (sl->object)) { context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object)); - if (context) - g_signal_connect_swapped (context, "state-change", G_CALLBACK (refresh_all), sl); + if (context != NULL) + { + g_signal_connect_swapped (context, "state-change", G_CALLBACK (refresh_all), sl); + g_object_unref (context); + } + gtk_stack_page_set_visible (page, TRUE); update_role (sl); update_path (sl); @@ -461,7 +472,11 @@ dispose (GObject *o) GtkATContext *context; context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object)); - g_signal_handlers_disconnect_by_func (context, refresh_all, sl); + if (context != NULL) + { + g_signal_handlers_disconnect_by_func (context, refresh_all, sl); + g_object_unref (context); + } } g_clear_object (&sl->object); |