mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-05 00:46:16 +01:00
private: Fix memory leak in tests
Don't use g_private_new(), it's deprecated, and leaks by definition. https://bugzilla.gnome.org/show_bug.cgi?id=711751
This commit is contained in:
parent
ae6dbb35cb
commit
e74b4351a3
@ -32,20 +32,18 @@
|
||||
static void
|
||||
test_private1 (void)
|
||||
{
|
||||
GPrivate *private1;
|
||||
static GPrivate private = G_PRIVATE_INIT (NULL);
|
||||
gpointer value;
|
||||
|
||||
private1 = g_private_new (NULL);
|
||||
|
||||
value = g_private_get (private1);
|
||||
value = g_private_get (&private);
|
||||
g_assert (value == NULL);
|
||||
|
||||
g_private_set (private1, GINT_TO_POINTER(1));
|
||||
value = g_private_get (private1);
|
||||
g_private_set (&private, GINT_TO_POINTER(1));
|
||||
value = g_private_get (&private);
|
||||
g_assert_cmpint (GPOINTER_TO_INT (value), ==, 1);
|
||||
|
||||
g_private_set (private1, GINT_TO_POINTER(2));
|
||||
value = g_private_get (private1);
|
||||
g_private_set (&private, GINT_TO_POINTER(2));
|
||||
value = g_private_get (&private);
|
||||
g_assert_cmpint (GPOINTER_TO_INT (value), ==, 2);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user