summaryrefslogtreecommitdiff
path: root/tests/gimarshallingtests.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gimarshallingtests.c')
-rw-r--r--tests/gimarshallingtests.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index aa78154a..38c278ad 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -3469,6 +3469,9 @@ gi_marshalling_tests_boxed_struct_copy (GIMarshallingTestsBoxedStruct *struct_)
{
GIMarshallingTestsBoxedStruct *new_struct;
+ if (struct_ == NULL)
+ return NULL;
+
new_struct = g_slice_new (GIMarshallingTestsBoxedStruct);
*new_struct = *struct_;
@@ -3479,7 +3482,8 @@ gi_marshalling_tests_boxed_struct_copy (GIMarshallingTestsBoxedStruct *struct_)
static void
gi_marshalling_tests_boxed_struct_free (GIMarshallingTestsBoxedStruct *struct_)
{
- g_slice_free (GIMarshallingTestsBoxedStruct, struct_);
+ if (struct_ != NULL)
+ g_slice_free (GIMarshallingTestsBoxedStruct, struct_);
}
GType
@@ -4444,6 +4448,7 @@ enum {
SOME_FLOAT_PROPERTY,
SOME_DOUBLE_PROPERTY,
SOME_STRV_PROPERTY,
+ SOME_BOXED_STRUCT_PROPERTY,
};
G_DEFINE_TYPE (GIMarshallingTestsPropertiesObject, gi_marshalling_tests_properties_object, G_TYPE_OBJECT);
@@ -4501,6 +4506,9 @@ gi_marshalling_tests_properties_object_get_property (GObject * object, guint pro
case SOME_STRV_PROPERTY:
g_value_set_boxed (value, self->some_strv);
break;
+ case SOME_BOXED_STRUCT_PROPERTY:
+ g_value_set_boxed (value, self->some_boxed_struct);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -4550,6 +4558,10 @@ gi_marshalling_tests_properties_object_set_property (GObject * object, guint pro
g_strfreev (self->some_strv);
self->some_strv = g_strdupv (g_value_get_boxed (value));
break;
+ case SOME_BOXED_STRUCT_PROPERTY:
+ gi_marshalling_tests_boxed_struct_free (self->some_boxed_struct);
+ self->some_boxed_struct = gi_marshalling_tests_boxed_struct_copy (g_value_get_boxed (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -4612,6 +4624,11 @@ gi_marshalling_tests_properties_object_class_init (GIMarshallingTestsPropertiesO
g_object_class_install_property (object_class, SOME_STRV_PROPERTY,
g_param_spec_boxed ("some-strv", "some-strv", "some-strv", G_TYPE_STRV,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, SOME_BOXED_STRUCT_PROPERTY,
+ g_param_spec_boxed ("some-boxed-struct", "some-boxed-struct", "some-boxed-struct",
+ gi_marshalling_tests_boxed_struct_get_type(),
+ G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}
GIMarshallingTestsPropertiesObject*