[pygobject/invoke-rewrite] [gi-invoke-ng] copy structs when transfer is full for array
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/invoke-rewrite] [gi-invoke-ng] copy structs when transfer is full for array
- Date: Tue, 28 Jun 2011 21:33:23 +0000 (UTC)
commit 7fc9d45860210fd9d333fd3769c6cf93a6a20eb6
Author: John (J5) Palmieri <johnp redhat com>
Date: Tue Jun 28 17:32:29 2011 -0400
[gi-invoke-ng] copy structs when transfer is full for array
gi/pygi-marshal.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/gi/pygi-marshal.c b/gi/pygi-marshal.c
index 7b868ae..4e9c4ec 100644
--- a/gi/pygi-marshal.c
+++ b/gi/pygi-marshal.c
@@ -1706,12 +1706,27 @@ _pygi_marshal_out_array (PyGIInvokeState *state,
GIArgument item_arg;
PyObject *py_item;
- if (seq_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY)
+ if (seq_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY) {
item_arg.v_pointer = g_ptr_array_index ( ( GPtrArray *)array_, i);
- else if (item_arg_cache->type_tag == GI_TYPE_TAG_INTERFACE)
+ } else if (item_arg_cache->type_tag == GI_TYPE_TAG_INTERFACE) {
item_arg.v_pointer = array_->data + i * item_size;
- else
+ if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) {
+ PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *) item_arg_cache;
+ switch (g_base_info_get_type (iface_cache->interface_info)) {
+ case GI_INFO_TYPE_STRUCT:
+ {
+ gpointer *_struct = g_malloc (item_size);
+ memcpy (_struct, item_arg.v_pointer, item_size);
+ item_arg.v_pointer = _struct;
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ } else {
memcpy (&item_arg, array_->data + i * item_size, item_size);
+ }
py_item = item_out_marshaller ( state,
callable_cache,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]