[pygobject] Fix memory leak with unboxed caller allocated structs



commit 6046ca87697fe80c6c0eb70f1efcad24de4f4fd8
Author: Simon Feltman <sfeltman src gnome org>
Date:   Sun Aug 17 21:53:55 2014 -0700

    Fix memory leak with unboxed caller allocated structs
    
    Take caller-allocates into account when wrapping unboxed structures.
    This will free the allocated memory when the Python object is de-alloced.

 gi/pygi-struct-marshal.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gi/pygi-struct-marshal.c b/gi/pygi-struct-marshal.c
index 4cfd4c1..3ffaf68 100644
--- a/gi/pygi-struct-marshal.c
+++ b/gi/pygi-struct-marshal.c
@@ -414,7 +414,7 @@ pygi_arg_struct_to_py_marshal (GIArgument *arg,
         if (py_type) {
             py_obj = _pygi_struct_new ((PyTypeObject *) py_type,
                                        arg->v_pointer,
-                                       transfer == GI_TRANSFER_EVERYTHING);
+                                       transfer == GI_TRANSFER_EVERYTHING || is_allocated);
         }
     } else {
         PyErr_Format (PyExc_NotImplementedError,


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