summaryrefslogtreecommitdiff
path: root/gi/pygi-list.c
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2018-02-16 16:54:06 +0100
committerMathieu Duponchelle <mathieu@centricular.com>2018-02-16 17:56:17 +0100
commit8df9570b7f25ceaaa590c8da33952a7bdeade203 (patch)
tree3168f30d6eb806e1a6802366b636ef7f985e9b50 /gi/pygi-list.c
parent9978b521450d9b2a038d48492550dcab49c7b113 (diff)
downloadpygobject-8df9570b7f25ceaaa590c8da33952a7bdeade203.tar.gz
array, list: always run items cleanup funcs
Diffstat (limited to 'gi/pygi-list.c')
-rw-r--r--gi/pygi-list.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/gi/pygi-list.c b/gi/pygi-list.c
index e9fc92ca..e8808fc2 100644
--- a/gi/pygi-list.c
+++ b/gi/pygi-list.c
@@ -356,26 +356,27 @@ _pygi_marshal_cleanup_to_py_glist (PyGIInvokeState *state,
{
GPtrArray *item_cleanups = (GPtrArray *) cleanup_data;
PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache;
+ GSList *list_ = (GSList *)data;
+
+ if (sequence_cache->item_cache->to_py_cleanup != NULL) {
+ PyGIMarshalToPyCleanupFunc cleanup_func =
+ sequence_cache->item_cache->to_py_cleanup;
+ GSList *node = list_;
+ guint i = 0;
+
+ while (node != NULL) {
+ cleanup_func (state,
+ sequence_cache->item_cache,
+ g_ptr_array_index(item_cleanups, i),
+ node->data,
+ was_processed);
+ node = node->next;
+ i++;
+ }
+ }
+
if (arg_cache->transfer == GI_TRANSFER_EVERYTHING ||
arg_cache->transfer == GI_TRANSFER_CONTAINER) {
- GSList *list_ = (GSList *)data;
-
- if (sequence_cache->item_cache->to_py_cleanup != NULL) {
- PyGIMarshalToPyCleanupFunc cleanup_func =
- sequence_cache->item_cache->to_py_cleanup;
- GSList *node = list_;
- guint i = 0;
-
- while (node != NULL) {
- cleanup_func (state,
- sequence_cache->item_cache,
- g_ptr_array_index(item_cleanups, i),
- node->data,
- was_processed);
- node = node->next;
- i++;
- }
- }
if (arg_cache->type_tag == GI_TYPE_TAG_GLIST) {
g_list_free ( (GList *)list_);