1. 03 Feb, 2014 3 commits
  2. 14 Oct, 2013 2 commits
    • Simon Feltman's avatar
      Fix GArray, GList, GSList, and GHashTable marshaling leaks · fe217e0a
      Simon Feltman authored
      Remove calling of cleanup code for transfer-everything modes by ensuring
      cleanup_data is set to NULL in from_py marshalers. Use array and hash
      table ref/unref functions for container transfer mode to ensure we have a
      valid container ref after invoke and during from_py cleanup of contents.
      Rework restrictions with to_py marshaling cleanup so we always unref the
      container for transfer-everything and transfer-container modes.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=693402
      fe217e0a
    • Simon Feltman's avatar
      Add cleanup_data argument used for Python to C marshaler cleanup · 7407367f
      Simon Feltman authored
      Add a new output argument to all from_py marshalers which is used for
      keeping track of marshaling data that later needs cleanup. Previously most
      marshalers would rely on the GIArgument->v_pointer as the means for data
      cleanup. However, this pointer would get clobbered in the case of
      bi-directional arguments (inout) and the memory lost.
      Use the new cleanup_data for storing temporarily wrapped C arrays so we
      don't need to re-calculate the length argument during cleanup.
      
      Additionally delay the from_py marshaling cleanup function until after
      _invoke_marshal_out_args is called. This gives inout arguments which don't
      modify the pointer sufficient time to exist until they marshaled back to
      Python (gi_marshalling_tests_gvalue_inout).
      
      https://bugzilla.gnome.org/show_bug.cgi?id=693402
      7407367f
  3. 09 Oct, 2013 1 commit
  4. 08 Oct, 2013 1 commit
    • Simon Feltman's avatar
      Fix GValue array marshaling leaks and crash fallout · 4623caa7
      Simon Feltman authored
      * Decrement references for results of PySequence_GetItem. There were a few
      places we were not decrementing the Python reference, leaking the value.
      * Add tracking of Python arguments with recursive marshaling cleanup. This
      allows arrays of GValues which have been coerced from Python types to be
      properly free'd (also fixes bug 703662).
      * Use g_variant_ref for variant arguments marked as transfer everything.
      This fixes double free's caused by the decrementing of PySequence_GetItem
      results.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=693402
      4623caa7
  5. 04 Oct, 2013 1 commit
  6. 26 Sep, 2013 1 commit
  7. 04 Mar, 2013 1 commit
    • Martin Pitt's avatar
      Fix leaking inout C arrays · d32b410a
      Martin Pitt authored
      g_*_info_invoke() changes the original state->in_args and state->args C arrays
      to the output values for (inout) arguments, thus losing the pointer to the
      originally allocated array. Remember that in state->args_data, so that we can
      free it in _pygi_marshal_cleanup_from_py_array().
      
      Reproduced by test_gi.TestArray.test_array_fixed_inout test case.
      d32b410a
  8. 28 Feb, 2013 1 commit
    • Martin Pitt's avatar
      Fix memory handling of caller-allocated boxed types · 64bcca2d
      Martin Pitt authored
      _pygi_marshal_to_py_interface_struct() and other places treat subtypes of
      G_TYPE_BOXED as boxed values and wrap them with _pygi_boxed_new(). Fix
      _caller_alloc() and _cleanup_caller_allocates() to consider G_TYPE_BOXED
      subtypes as well and use the slice allocator instead of malloc()'ing a struct.
      This avoids trying to free an malloc'ed struct with g_slice_free() and properly
      cleans up the boxed values.
      
      The leak was produced with:
      
      G_SLICE=debug-blocks PYTHONPATH=. valgrind --tool=memcheck --leak-check=full --show-possibly-lost=no \
        python3 -c 'from gi.repository import Gtk; b=Gtk.TextBuffer(); (s,e) = b.get_bounds()'
      64bcca2d
  9. 27 Feb, 2013 1 commit
    • Martin Pitt's avatar
      Fix cleanup of GValue arrays · 4f5e8b75
      Martin Pitt authored
      Commit bc1fd8 introduced a thinko: We must not change
      item_arg_cache->from_py_cleanup, as it's a global cache. Revert the original
      change, and instead put the hack into _pygi_marshal_cleanup_from_py_array(),
      which now short-circuits _pygi_marshal_cleanup_from_py_interface_struct_gvalue() to avoid
      trying to release a slice which has never been allocated in
      _pygi_marshal_from_py_array().
      
      https://bugzilla.gnome.org/show_bug.cgi?id=672224
      4f5e8b75
  10. 30 Jan, 2013 1 commit
  11. 17 Jan, 2013 1 commit
  12. 12 Oct, 2012 1 commit
  13. 27 Jul, 2012 1 commit
    • Martin Pitt's avatar
      Add missing static declarations · aae4e774
      Martin Pitt authored
      This fixes a lot of -Wmissing-prototype warnings.
      
      Also remove _pygi_marshal_cleanup_closure_unref() which is not used anywhere.
      aae4e774
  14. 20 Apr, 2012 1 commit
  15. 16 Mar, 2012 1 commit
    • Martin Pitt's avatar
      Fix Python to C marshalling of GValue arrays · d7d28d71
      Martin Pitt authored
      For GValues we cannot just copy the GValue memory in
      _pygi_marshal_from_py_array(), as the from_py_cleanup() function clears and
      releases the GValue and with it its v_pointer. Use g_value_copy() to copy by
      value instead.
      
      This uncovered another bug in _pygi_marshal_cleanup_from_py_array(): It always
      assumed that C arrays contained pointers, but this is not the case for GValue
      arrays: these are actual struct arrays, not struct pointer arrays (cf. their
      construction in _pygi_marshal_from_py_array()). Check if an array contains
      pointers or values and compute the correct array item pointer for both cases.
      
      Also add a corresponding test case for marshalling GValue arrays from C back to
      Python, which works fine.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=672065
      d7d28d71
  16. 06 Feb, 2012 1 commit
  17. 24 Jan, 2012 1 commit
  18. 25 Oct, 2011 1 commit
  19. 12 Sep, 2011 1 commit
    • John (J5) Palmieri's avatar
      refactor in/out marshalling to be to_py/from_py · a4e4318b
      John (J5) Palmieri authored
      * in/out make sense from a C perspective but when you get to the
         python layers it makes more sense to label them as to_py and
         from_py to denote which way we are marshalling
       * this helps clear up the difference between callbacks which
         call into python and invoked functions which call into C
       * in the callback case we marshal in values to Python objects
         and out values to C types but in the invoke case we do the
         reverse.  Dealing with to_py/from_py makes the code much more
         resuable and consistant
      
      https://bugzilla.gnome.org/show_bug.cgi?id=658362
      a4e4318b
  20. 05 Jul, 2011 1 commit
  21. 24 Jun, 2011 1 commit
  22. 15 Jun, 2011 1 commit
  23. 14 Jun, 2011 1 commit
  24. 31 May, 2011 4 commits
  25. 26 May, 2011 2 commits
  26. 23 May, 2011 1 commit
  27. 12 May, 2011 1 commit
  28. 05 May, 2011 1 commit
  29. 29 Apr, 2011 1 commit
  30. 28 Apr, 2011 1 commit
  31. 12 Apr, 2011 1 commit
    • John (J5) Palmieri's avatar
      [gi-invoke-ng] create new framework for cleaning up args · 12aa4e63
      John (J5) Palmieri authored
      * we now have a state machine so we know what point in the marshalling process
        we are and which args need to be cleaned up
      * call the cleanup functions after invoking the gi callable, after marshalling
        the out parameters and at any time an error occures
      12aa4e63