[gtk/stack-fixes] selection tests: Plug a memory leak



commit cdb729441e8a76202d06bf7ebf1510a7cb34414b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Feb 10 21:08:44 2019 -0500

    selection tests: Plug a memory leak

 testsuite/gtk/singleselection.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/testsuite/gtk/singleselection.c b/testsuite/gtk/singleselection.c
index 6d685e4b29..ec3588528a 100644
--- a/testsuite/gtk/singleselection.c
+++ b/testsuite/gtk/singleselection.c
@@ -28,9 +28,12 @@ static guint
 get (GListModel *model,
      guint       position)
 {
+  guint number;
   GObject *object = g_list_model_get_item (model, position);
   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 *
@@ -285,6 +288,7 @@ test_create (void)
   assert_selection_changes (selection, "");
 
   g_object_unref (store);
+
   assert_model (selection, "1 3 5");
   assert_changes (selection, "");
   assert_selection (selection, "");
@@ -324,8 +328,8 @@ test_changes (void)
   assert_selection (selection, "");
   assert_selection_changes (selection, "");
 
-  g_object_unref (store);
   g_object_unref (selection);
+  g_object_unref (store);
 }
 
 static void


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