[glib/glib-2-48] gio/tests/gsettings: fix GSettings reference leaks in some tests



commit d175c7f4d8dcb117ddeb183ad52ff462f97011f2
Author: Aurélien Zanelli <aurelien zanelli parrot com>
Date:   Fri Jul 8 11:04:37 2016 +0200

    gio/tests/gsettings: fix GSettings reference leaks in some tests
    
    GSettings objects were not unreffed in test_flags, test_enums and
    test_ranges tests and when we skip internationalization tests, ie
    test_l10n(_context).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768560

 gio/tests/gsettings.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c
index ee8e8fa..b882d38 100644
--- a/gio/tests/gsettings.c
+++ b/gio/tests/gsettings.c
@@ -737,7 +737,6 @@ test_l10n (void)
       str = g_settings_get_string (settings, "error-message");
 
       g_assert_cmpstr (str, ==, "Unbenannt");
-      g_object_unref (settings);
       g_free (str);
       str = NULL;
     }
@@ -746,6 +745,7 @@ test_l10n (void)
 
   setlocale (LC_MESSAGES, locale);
   g_free (locale);
+  g_object_unref (settings);
 }
 
 /* Test that message context works as expected with translated
@@ -784,7 +784,6 @@ test_l10n_context (void)
       g_settings_get (settings, "backspace", "s", &str);
 
       g_assert_cmpstr (str, ==, "Löschen");
-      g_object_unref (settings);
       g_free (str);
       str = NULL;
     }
@@ -793,6 +792,7 @@ test_l10n_context (void)
 
   setlocale (LC_MESSAGES, locale);
   g_free (locale);
+  g_object_unref (settings);
 }
 
 enum
@@ -1883,6 +1883,9 @@ test_enums (void)
   g_free (str);
 
   g_assert_cmpint (g_settings_get_enum (settings, "test"), ==, TEST_ENUM_QUUX);
+
+  g_object_unref (direct);
+  g_object_unref (settings);
 }
 
 static void
@@ -1991,6 +1994,9 @@ test_flags (void)
 
   g_assert_cmpint (g_settings_get_flags (settings, "f-test"), ==,
                    TEST_FLAGS_TALKING | TEST_FLAGS_LAUGHING);
+
+  g_object_unref (direct);
+  g_object_unref (settings);
 }
 
 static void
@@ -2055,6 +2061,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   g_assert (!g_settings_range_check (settings, "val", value));
   g_variant_unref (value);
 G_GNUC_END_IGNORE_DEPRECATIONS
+
+  g_object_unref (direct);
+  g_object_unref (settings);
 }
 
 static gboolean


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