[libadwaita] adw-settings: Fix a leak if schema doesn’t have the expected keys
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita] adw-settings: Fix a leak if schema doesn’t have the expected keys
- Date: Sun, 6 Mar 2022 18:20:06 +0000 (UTC)
commit 260cfa445d0dfe3cd2dcca2a6ce1b4ed510c1936
Author: Philip Withnall <pwithnall endlessos org>
Date: Thu Mar 3 16:39:53 2022 +0000
adw-settings: Fix a leak if schema doesn’t have the expected keys
The `GSettingsSchema`s should be unreffed unconditionally, not
conditionally.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
src/adw-settings.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/adw-settings.c b/src/adw-settings.c
index c2571ac0..12e908d1 100644
--- a/src/adw-settings.c
+++ b/src/adw-settings.c
@@ -429,10 +429,10 @@ init_gsettings (AdwSettings *self)
"changed::color-scheme",
G_CALLBACK (gsettings_color_scheme_changed_cb),
self);
-
- g_settings_schema_unref (schema);
}
+ g_clear_pointer (&schema, g_settings_schema_unref);
+
schema = g_settings_schema_source_lookup (source, "org.gnome.desktop.a11y.interface", TRUE);
if (schema &&
!self->has_high_contrast &&
@@ -445,9 +445,9 @@ init_gsettings (AdwSettings *self)
"changed::high-contrast",
G_CALLBACK (gsettings_high_contrast_changed_cb),
self);
-
- g_settings_schema_unref (schema);
}
+
+ g_clear_pointer (&schema, g_settings_schema_unref);
}
/* Legacy */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]