selection tests: Plug a memory leak

This commit is contained in:
Matthias Clasen 2019-02-10 21:08:44 -05:00
parent 916508f3db
commit cdb729441e

View File

@ -28,9 +28,12 @@ static guint
get (GListModel *model, get (GListModel *model,
guint position) guint position)
{ {
guint number;
GObject *object = g_list_model_get_item (model, position); GObject *object = g_list_model_get_item (model, position);
g_assert (object != NULL); g_assert (object != NULL);
return GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark)); number = GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
g_object_unref (object);
return number;
} }
static char * static char *
@ -285,6 +288,7 @@ test_create (void)
assert_selection_changes (selection, ""); assert_selection_changes (selection, "");
g_object_unref (store); g_object_unref (store);
assert_model (selection, "1 3 5"); assert_model (selection, "1 3 5");
assert_changes (selection, ""); assert_changes (selection, "");
assert_selection (selection, ""); assert_selection (selection, "");
@ -324,8 +328,8 @@ test_changes (void)
assert_selection (selection, ""); assert_selection (selection, "");
assert_selection_changes (selection, ""); assert_selection_changes (selection, "");
g_object_unref (store);
g_object_unref (selection); g_object_unref (selection);
g_object_unref (store);
} }
static void static void