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
This commit is contained in:
Aurélien Zanelli 2016-07-08 11:04:37 +02:00 committed by Matthias Clasen
parent 42dad59cc1
commit b121a7916d

View File

@ -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
@ -1893,6 +1893,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
@ -2001,6 +2004,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
@ -2065,6 +2071,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