Commit 9454c01f authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Martin Pitt
Browse files

Fix marshalling of arrays of boxed struct values

This fixes methods like gtk_selection_set_with_data().  In such cases
data is passed as an array of struct pointers, so it must be converted
to an array of structs.

Co-Authored-By: default avatarMartin Pitt <>
parent 231d5a7c
......@@ -1009,6 +1009,12 @@ _pygi_marshal_from_py_array (PyGIInvokeState *state,
if (from_py_cleanup)
from_py_cleanup (state, item_arg_cache, item.v_pointer, TRUE);
} else if (is_boxed && !item_iface_cache->arg_cache.is_pointer) {
/* The array elements are not expected to be pointers, but the
* elements obtained are boxed pointers themselves, so insert
* the pointed to data.
g_array_insert_vals (array_, i, item.v_pointer, 1);
} else {
g_array_insert_val (array_, i, item);
......@@ -812,6 +812,18 @@ class TestArray(unittest.TestCase):
GIMarshallingTests.array_struct_in([struct1, struct2, struct3])
@unittest.skipUnless(hasattr(GIMarshallingTests, 'array_struct_value_in'),
'too old gobject-introspection')
def test_array_boxed_struct_value_in(self):
struct1 = GIMarshallingTests.BoxedStruct()
struct1.long_ = 1
struct2 = GIMarshallingTests.BoxedStruct()
struct2.long_ = 2
struct3 = GIMarshallingTests.BoxedStruct()
struct3.long_ = 3
GIMarshallingTests.array_struct_value_in([struct1, struct2, struct3])
def test_array_boxed_struct_take_in(self):
struct1 = GIMarshallingTests.BoxedStruct()
struct1.long_ = 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment