[gtk/matthiasc/for-master] Fix leaks in tests
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] Fix leaks in tests
- Date: Wed, 4 Dec 2019 12:54:39 +0000 (UTC)
commit 9e50bc74fae812a656f559a9f707bd282b2b33fa
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Dec 4 07:51:04 2019 -0500
Fix leaks in tests
All the list model tests were leaking items,
because g_list_model_get_item is transfer full.
Fixing these unveils a crash in the treelistmodel
and maplistmodel tests.
testsuite/gtk/filterlistmodel.c | 1 +
testsuite/gtk/flattenlistmodel.c | 1 +
testsuite/gtk/maplistmodel.c | 1 +
testsuite/gtk/slicelistmodel.c | 1 +
testsuite/gtk/sortlistmodel.c | 1 +
testsuite/gtk/treelistmodel.c | 1 +
6 files changed, 6 insertions(+)
---
diff --git a/testsuite/gtk/filterlistmodel.c b/testsuite/gtk/filterlistmodel.c
index 6cd9111255..184be70178 100644
--- a/testsuite/gtk/filterlistmodel.c
+++ b/testsuite/gtk/filterlistmodel.c
@@ -30,6 +30,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
g_assert (object != NULL);
+ g_object_unref (object);
return GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
}
diff --git a/testsuite/gtk/flattenlistmodel.c b/testsuite/gtk/flattenlistmodel.c
index 79921e5042..1c44a92261 100644
--- a/testsuite/gtk/flattenlistmodel.c
+++ b/testsuite/gtk/flattenlistmodel.c
@@ -30,6 +30,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
g_assert (object != NULL);
+ g_object_unref (object);
return GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
}
diff --git a/testsuite/gtk/maplistmodel.c b/testsuite/gtk/maplistmodel.c
index 11f87f0d37..5c39aaa489 100644
--- a/testsuite/gtk/maplistmodel.c
+++ b/testsuite/gtk/maplistmodel.c
@@ -30,6 +30,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
g_assert (object != NULL);
+ g_object_unref (object);
return GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
}
diff --git a/testsuite/gtk/slicelistmodel.c b/testsuite/gtk/slicelistmodel.c
index a672feeac8..7887cceb12 100644
--- a/testsuite/gtk/slicelistmodel.c
+++ b/testsuite/gtk/slicelistmodel.c
@@ -29,6 +29,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
g_assert (object != NULL);
+ g_object_unref (object);
return GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
}
diff --git a/testsuite/gtk/sortlistmodel.c b/testsuite/gtk/sortlistmodel.c
index 03b5c8ad64..079141c6fe 100644
--- a/testsuite/gtk/sortlistmodel.c
+++ b/testsuite/gtk/sortlistmodel.c
@@ -30,6 +30,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
g_assert (object != NULL);
+ g_object_unref (object);
return GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
}
diff --git a/testsuite/gtk/treelistmodel.c b/testsuite/gtk/treelistmodel.c
index a54d869aa3..10d5334e76 100644
--- a/testsuite/gtk/treelistmodel.c
+++ b/testsuite/gtk/treelistmodel.c
@@ -30,6 +30,7 @@ get (GListModel *model,
{
GObject *object = g_list_model_get_item (model, position);
g_assert (object != NULL);
+ g_object_unref (object);
return GPOINTER_TO_UINT (g_object_get_qdata (object, number_quark));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]