From 932bf2a700368e46b30b58ec9b6beb3ff09a081c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 1 Jun 2012 12:31:15 +0200 Subject: [PATCH] tests: Add vfunc taking a caller-allocated out parameter This reproduces https://bugzilla.gnome.org/show_bug.cgi?id=653151 --- tests/gimarshallingtests.c | 13 +++++++++++++ tests/gimarshallingtests.h | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 9d58e26..aa78154 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -4020,6 +4020,19 @@ gi_marshalling_tests_object_vfunc_multiple_out_parameters (GIMarshallingTestsObj } /** + * gi_marshalling_tests_object_vfunc_caller_allocated_out_parameter: + * @a: (out): + */ +void +gi_marshalling_tests_object_vfunc_caller_allocated_out_parameter (GIMarshallingTestsObject *self, GValue *a) +{ + /* make sure that local variables don't get smashed */ + gulong local = 0x12345678; + GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_caller_allocated_out_parameter (self, a); + g_assert_cmpint(local, ==, 0x12345678); +} + +/** * gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter: * @a: (out): */ diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h index 2c022c6..7300b2a 100644 --- a/tests/gimarshallingtests.h +++ b/tests/gimarshallingtests.h @@ -735,6 +735,12 @@ struct _GIMarshallingTestsObjectClass void (* vfunc_multiple_out_parameters) (GIMarshallingTestsObject *self, gfloat *a, gfloat *b); /** + * GIMarshallingTestsObjectClass::vfunc_caller_allocated_out_parameter: + * @a: (out): + */ + void (* vfunc_caller_allocated_out_parameter) (GIMarshallingTestsObject *self, GValue *a); + + /** * GIMarshallingTestsObjectClass::vfunc_return_value_and_one_out_parameter: * @a: (out): */ @@ -780,6 +786,7 @@ void gi_marshalling_tests_object_method_with_default_implementation (GIMarshalli glong gi_marshalling_tests_object_vfunc_return_value_only (GIMarshallingTestsObject *self); void gi_marshalling_tests_object_vfunc_one_out_parameter (GIMarshallingTestsObject *self, gfloat *a); void gi_marshalling_tests_object_vfunc_multiple_out_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b); +void gi_marshalling_tests_object_vfunc_caller_allocated_out_parameter (GIMarshallingTestsObject *self, GValue *a); glong gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter (GIMarshallingTestsObject *self, glong *a); glong gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters (GIMarshallingTestsObject *self, glong *a, glong *b); gboolean gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *object, gint x, GError **error); -- 2.7.4