diff options
| author | Mathieu Duponchelle <mathieu@centricular.com> | 2018-02-15 23:32:37 +0100 |
|---|---|---|
| committer | Mathieu Duponchelle <mathieu@centricular.com> | 2018-02-16 17:56:16 +0100 |
| commit | e41dd91e9e62eeaeaa0fee97b50500591a87b249 (patch) | |
| tree | fe0529fcd0cff7732fa65aded5d48845d8a3f0a3 /gi/pygi-struct-marshal.c | |
| parent | b1d1c8d9d8820fe405bddd8e9dea88b5ec2fcce2 (diff) | |
| download | pygobject-e41dd91e9e62eeaeaa0fee97b50500591a87b249.tar.gz | |
Revert "Revert "to python struct marshalling: copy boxed during cleanup""
This reverts commit 10c062001ddd948b0a70545cbf613b38ed6fa46c.
Diffstat (limited to 'gi/pygi-struct-marshal.c')
| -rw-r--r-- | gi/pygi-struct-marshal.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/gi/pygi-struct-marshal.c b/gi/pygi-struct-marshal.c index f1b9f13b..44797e75 100644 --- a/gi/pygi-struct-marshal.c +++ b/gi/pygi-struct-marshal.c @@ -439,14 +439,19 @@ arg_struct_to_py_marshal_adapter (PyGIInvokeState *state, gpointer *cleanup_data) { PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; + PyObject *ret; - return pygi_arg_struct_to_py_marshal (arg, - iface_cache->interface_info, - iface_cache->g_type, - iface_cache->py_type, - arg_cache->transfer, - arg_cache->is_caller_allocates, - iface_cache->is_foreign); + ret = pygi_arg_struct_to_py_marshal (arg, + iface_cache->interface_info, + iface_cache->g_type, + iface_cache->py_type, + arg_cache->transfer, + arg_cache->is_caller_allocates, + iface_cache->is_foreign); + + *cleanup_data = ret; + + return ret; } static void @@ -463,6 +468,17 @@ arg_foreign_to_py_cleanup (PyGIInvokeState *state, } } +static void +arg_boxed_to_py_cleanup (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + gpointer cleanup_data, + gpointer data, + gboolean was_processed) +{ + if (arg_cache->transfer == GI_TRANSFER_NOTHING) + _pygi_boxed_copy_in_place ((PyGIBoxed *) cleanup_data); +} + static gboolean arg_type_class_from_py_marshal (PyGIInvokeState *state, PyGICallableCache *callable_cache, @@ -542,6 +558,10 @@ arg_struct_to_py_setup (PyGIArgCache *arg_cache, if (iface_cache->is_foreign) arg_cache->to_py_cleanup = arg_foreign_to_py_cleanup; + else if (!g_type_is_a (iface_cache->g_type, G_TYPE_VALUE) && + iface_cache->py_type && + g_type_is_a (iface_cache->g_type, G_TYPE_BOXED)) + arg_cache->to_py_cleanup = arg_boxed_to_py_cleanup; } PyGIArgCache * |
