From 18a1d426e7a7dc1034c0012a14ca31e73fe266a0 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 5 Oct 2021 20:42:01 +0100 Subject: [PATCH] adw-settings: Fix a GSettingsSchema leak `g_settings_schema_source_lookup()` returns a new reference. Signed-off-by: Philip Withnall --- src/adw-settings.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/adw-settings.c b/src/adw-settings.c index 206d396d4..80f9b135f 100644 --- a/src/adw-settings.c +++ b/src/adw-settings.c @@ -304,7 +304,8 @@ static void init_gsettings (AdwSettings *self) { GSettingsSchemaSource *source; - GSettingsSchema *schema; + g_autoptr (GSettingsSchema) schema = NULL; + g_autoptr (GSettingsSchema) a11y_schema = NULL; /* While we can access gsettings in flatpak, we can't do anything useful with * them as they aren't propagated from the system. */ @@ -327,10 +328,10 @@ init_gsettings (AdwSettings *self) self); } - schema = g_settings_schema_source_lookup (source, "org.gnome.desktop.a11y.interface", TRUE); - if (schema && + a11y_schema = g_settings_schema_source_lookup (source, "org.gnome.desktop.a11y.interface", TRUE); + if (a11y_schema && !self->has_high_contrast && - g_settings_schema_has_key (schema, "high-contrast")) { + g_settings_schema_has_key (a11y_schema, "high-contrast")) { self->has_high_contrast = TRUE; self->a11y_settings = g_settings_new ("org.gnome.desktop.a11y.interface"); self->high_contrast = g_settings_get_boolean (self->a11y_settings, "high-contrast"); -- GitLab