diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2011-10-14 17:31:28 -0400 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2011-10-14 17:31:28 -0400 |
commit | 1a4ecfcb905300e52ba782eee089dc66da75b3fe (patch) | |
tree | 3a627faf1cb94ca897c4e052456290460f8e17da /tests/scanner/regress.c | |
parent | 52e12815dc33af5dab95c08d29396c48ed8055c9 (diff) | |
download | gobject-introspection-1a4ecfcb905300e52ba782eee089dc66da75b3fe.tar.gz |
add test for checking refcounting of signals with transfer none object params
Diffstat (limited to 'tests/scanner/regress.c')
-rw-r--r-- | tests/scanner/regress.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index d44e692b..d1efb2e3 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -1815,6 +1815,7 @@ enum { REGRESS_TEST_OBJ_SIGNAL_SIG_NEW_WITH_ARRAY_PROP, REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_HASH_PROP, REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_STRV, + REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_OBJ, REGRESS_TEST_OBJ_SIGNAL_FIRST, REGRESS_TEST_OBJ_SIGNAL_CLEANUP, REGRESS_TEST_OBJ_SIGNAL_ALL, @@ -1914,6 +1915,26 @@ regress_test_obj_class_init (RegressTestObjClass *klass) 1, G_TYPE_STRV); + /** + * RegressTestObj::sig-with-obj: + * @self: an object + * @obj: (transfer none): A newly created RegressTestObj + * + * Test transfer none GObject as a param (tests refcounting). + * Use with regress_test_obj_emit_sig_with_obj + */ + regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_OBJ] = + g_signal_new ("sig-with-obj", + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + G_TYPE_OBJECT); + regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_FIRST] = g_signal_new ("first", G_TYPE_FROM_CLASS (gobject_class), @@ -2108,6 +2129,15 @@ regress_test_obj_set_bare (RegressTestObj *obj, GObject *bare) g_object_ref (obj->bare); } +void +regress_test_obj_emit_sig_with_obj (RegressTestObj *obj) +{ + RegressTestObj *obj_param = regress_constructor (); + g_object_set (obj_param, "int", 3, NULL); + g_signal_emit_by_name (obj, "sig-with-obj", obj_param); + g_object_unref (obj_param); +} + int regress_test_obj_instance_method (RegressTestObj *obj) { |