[pygobject] Use cleanup data for argument marshalling failures



commit 662a4421125d126a11ca163c362d205f0c2147c4
Author: Simon Feltman <sfeltman src gnome org>
Date:   Wed Jul 30 12:46:18 2014 -0700

    Use cleanup data for argument marshalling failures
    
    Use state->args_cleanup_data when cleaning up failed argument marshalling.
    This was overlooked when cleanup data tracking was implemented (commit 7407367f).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695128

 gi/pygi-marshal-cleanup.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gi/pygi-marshal-cleanup.c b/gi/pygi-marshal-cleanup.c
index 0f6fee3..4ba6159 100644
--- a/gi/pygi-marshal-cleanup.c
+++ b/gi/pygi-marshal-cleanup.c
@@ -166,26 +166,26 @@ pygi_marshal_cleanup_args_from_py_parameter_fail (PyGIInvokeState   *state,
     for (i = 0; i < _pygi_callable_cache_args_len (cache)  && i <= failed_arg_index; i++) {
         PyGIArgCache *arg_cache = _pygi_callable_cache_get_arg (cache, i);
         PyGIMarshalCleanupFunc cleanup_func = arg_cache->from_py_cleanup;
-        gpointer data = state->arg_values[i].v_pointer;
+        gpointer cleanup_data = state->args_cleanup_data[i];
         PyObject *py_arg = PyTuple_GET_ITEM (state->py_in_args,
                                              arg_cache->py_arg_index);
 
-        if (cleanup_func &&
-                arg_cache->direction == PYGI_DIRECTION_FROM_PYTHON &&
-                    data != NULL) {
+        if (cleanup_func && cleanup_data != NULL &&
+                arg_cache->direction == PYGI_DIRECTION_FROM_PYTHON) {
             cleanup_func (state,
                           arg_cache,
                           py_arg,
-                          data,
+                          cleanup_data,
                           i < failed_arg_index);
 
-        } else if (arg_cache->is_caller_allocates && data != NULL) {
+        } else if (arg_cache->is_caller_allocates && cleanup_data != NULL) {
             _cleanup_caller_allocates (state,
                                        arg_cache,
                                        py_arg,
-                                       data,
+                                       cleanup_data,
                                        FALSE);
         }
+        state->args_cleanup_data[i] = NULL;
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]