[libadwaita] adw-settings: Fix a GSettingsSchema leak



commit 18a1d426e7a7dc1034c0012a14ca31e73fe266a0
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Oct 5 20:42:01 2021 +0100

    adw-settings: Fix a GSettingsSchema leak
    
    `g_settings_schema_source_lookup()` returns a new reference.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 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 206d396d..80f9b135 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");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]