[pygobject/invoke-rewrite] [gi] fix marshalling fixed arrays
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/invoke-rewrite] [gi] fix marshalling fixed arrays
- Date: Wed, 12 Jan 2011 21:24:41 +0000 (UTC)
commit d54d12c66226910952b0dc44c8d9514a7edaa6f2
Author: John (J5) Palmieri <johnp redhat com>
Date: Wed Jan 12 16:23:02 2011 -0500
[gi] fix marshalling fixed arrays
* get the correct item_size and pass the GArray data not the GArray
gi/pygi-argument.c | 39 ++++++++++++++++++++++-----------------
gi/pygi-cache.c | 3 ++-
2 files changed, 24 insertions(+), 18 deletions(-)
---
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index a490878..837f088 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -2601,29 +2601,34 @@ _pygi_marshal_in_array (PyGIInvokeState *state,
for (i = 0; i < length; i++) {
GIArgument item;
PyObject *py_item = PySequence_GetItem (py_arg, i);
- if (py_item == NULL) {
- int j;
- if (sequence_cache->item_cache->cleanup != NULL) {
- GDestroyNotify cleanup = sequence_cache->item_cache->cleanup;
- /*for(j = 0; j < i; j++)
- cleanup((gpointer)(array_->data[j]));*/
- }
+ if (py_item == NULL)
+ goto err;
+
+ if (!in_marshaller(state,
+ function_cache,
+ sequence_cache->item_cache,
+ py_item,
+ &item))
+ goto err;
- g_array_free(array_, TRUE);
- _PyGI_ERROR_PREFIX ("Item %i: ", i);
- return FALSE;
- }
- sequence_cache->item_cache->in_marshaller(state,
- function_cache,
- sequence_cache->item_cache,
- py_item,
- &item);
g_array_insert_val(array_, i, item);
+ continue;
+err:
+ if (sequence_cache->item_cache->cleanup != NULL) {
+ GDestroyNotify cleanup = sequence_cache->item_cache->cleanup;
+ /*for(j = 0; j < i; j++)
+ cleanup((gpointer)(array_->data[j]));*/
+ }
+
+ g_array_free(array_, TRUE);
+ _PyGI_ERROR_PREFIX ("Item %i: ", i);
+ return FALSE;
}
array_success:
- (*arg).v_pointer = array_;
+ (*arg).v_pointer = array_->data;
+ g_array_free(array_, FALSE);
return TRUE;
}
diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c
index 168d946..7622e72 100644
--- a/gi/pygi-cache.c
+++ b/gi/pygi-cache.c
@@ -176,7 +176,8 @@ _sequence_cache_new_from_type_info(GITypeInfo *type_info)
return NULL;
}
- sc->item_cache->type_tag = item_type_tag;
+ sc->item_cache->type_tag = item_type_tag;
+ sc->item_size = _pygi_g_type_tag_size(item_type_tag);
g_base_info_unref( (GIBaseInfo *) item_type_info);
return sc;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]