[pygobject] Reinstate copying of in-line structs in arrays
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Reinstate copying of in-line structs in arrays
- Date: Thu, 25 Aug 2011 17:32:01 +0000 (UTC)
commit 631d8ef879a13492945a3e30b3df9863a4ba2f44
Author: Mike Gorse <mgorse novell com>
Date: Wed Aug 24 17:30:09 2011 -0500
Reinstate copying of in-line structs in arrays
For arrays of in-line, non-boxed structures with (transfer full),
_pygi_marshal_free_out_array eventually gets called and frees the array
data, so we should copy it (IE, BGO#653588).
https://bugzilla.gnome.org/show_bug.cgi?id=657120
gi/pygi-marshal-out.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gi/pygi-marshal-out.c b/gi/pygi-marshal-out.c
index ecf8974..e72db80 100644
--- a/gi/pygi-marshal-out.c
+++ b/gi/pygi-marshal-out.c
@@ -335,7 +335,13 @@ _pygi_marshal_out_array (PyGIInvokeState *state,
switch (g_base_info_get_type (iface_cache->interface_info)) {
case GI_INFO_TYPE_STRUCT:
- item_arg.v_pointer = array_->data + i * item_size;
+ if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) {
+ gpointer *_struct = g_malloc (item_size);
+ memcpy (_struct, array_->data + i * item_size,
+ item_size);
+ item_arg.v_pointer = _struct;
+ } else
+ item_arg.v_pointer = array_->data + i * item_size;
break;
default:
item_arg.v_pointer = g_array_index (array_, gpointer, i);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]