From 7254fd7aa323942182339bdde5c978e7aab59ba1 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 21 Sep 2022 11:03:44 +0100 Subject: [PATCH] gobject/tests: Don't unref a floating object reference by mistake This goes undiagnosed under normal circumstances, but is a critical warning (which is fatal by default) under G_ENABLE_DIAGNOSTIC. This is a programming error, so we should only exercise it under g_test_undefined(), and only in a test that is intentionally doing this (as in the previous commit). Signed-off-by: Simon McVittie --- gobject/tests/type.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gobject/tests/type.c b/gobject/tests/type.c index 50cb2c92f..458bb6bf1 100644 --- a/gobject/tests/type.c +++ b/gobject/tests/type.c @@ -185,7 +185,7 @@ test_interface_check (void) check_called = 0; g_type_add_interface_check (&check_called, check_func); - o = g_object_new (bazo_get_type (), NULL); + o = g_object_ref_sink (g_object_new (bazo_get_type (), NULL)); g_object_unref (o); g_assert_cmpint (check_called, ==, 1); g_type_remove_interface_check (&check_called, check_func);