[glib/wip/smcv/deprecated-prop-followup: 4/5] gobject/tests: Don't unref a floating object reference by mistake
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/smcv/deprecated-prop-followup: 4/5] gobject/tests: Don't unref a floating object reference by mistake
- Date: Wed, 21 Sep 2022 10:21:28 +0000 (UTC)
commit 7254fd7aa323942182339bdde5c978e7aab59ba1
Author: Simon McVittie <smcv collabora com>
Date: Wed Sep 21 11:03:44 2022 +0100
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 <smcv collabora com>
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 50cb2c92fb..458bb6bf15 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]