From c0eb133e2d7eac3902369ba6cc12b2ae5d73a478 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Sun, 25 Dec 2016 22:52:09 +0100 Subject: [PATCH] tests: ref_sink before unref a GtkWidget Widgets usually have floating references, meaning that reference should be transformed into a hard reference before removing it. Convert it early in the testing, so we can handle widgets and other objects in the same way. --- src/tests/adg-test.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tests/adg-test.c b/src/tests/adg-test.c index 5604a429..05bbd119 100644 --- a/src/tests/adg-test.c +++ b/src/tests/adg-test.c @@ -279,6 +279,15 @@ _adg_object_checks(GType *p_type) g_assert_nonnull(object); g_assert_true(G_IS_OBJECT(object)); + /* Convert the floating reference, if present, to a hard reference so + * we can handle GTK+ widgets (that usually have a floating reference) + * and other object (that do not usually have floating references) in + * the same way. + */ + if (g_object_is_floating(object)) { + g_object_ref_sink(object); + } + /* Check that unknown or unexistent properties does * not return values (result should pass unmodified) */ -- 2.11.4.GIT