[pygobject] Mark caller-allocated boxed structures as having a slice allocated



commit dc3d21173b75232f7ea0b9913f7309486456a69d
Author: Mike Gorse <mgorse suse com>
Date:   Thu Jan 10 15:48:30 2013 -0600

    Mark caller-allocated boxed structures as having a slice allocated
    
    When a C function takes a pointer and fills it with a boxed structure (ie,
    gtk_tree_store_insert_with_values), pygi should deallocate the slice when the
    box is no longer being used.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699501

 gi/pygi-marshal-to-py.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gi/pygi-marshal-to-py.c b/gi/pygi-marshal-to-py.c
index d486d28..d5a0734 100644
--- a/gi/pygi-marshal-to-py.c
+++ b/gi/pygi-marshal-to-py.c
@@ -815,7 +815,9 @@ _pygi_marshal_to_py_interface_struct (PyGIInvokeState   *state,
                                                               arg->v_pointer);
     } else if (g_type_is_a (type, G_TYPE_BOXED)) {
         py_obj = _pygi_boxed_new ( (PyTypeObject *)iface_cache->py_type, arg->v_pointer, 
-                                  arg_cache->transfer == GI_TRANSFER_EVERYTHING);
+                                  arg_cache->transfer == GI_TRANSFER_EVERYTHING || arg_cache->is_caller_allocates);
+        if (arg_cache->is_caller_allocates)
+          ((PyGIBoxed *)py_obj)->slice_allocated = TRUE;
     } else if (g_type_is_a (type, G_TYPE_POINTER)) {
         if (iface_cache->py_type == NULL ||
                 !PyType_IsSubtype ( (PyTypeObject *)iface_cache->py_type, &PyGIStruct_Type)) {



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