diff options
author | Martin Pitt <martinpitt@gnome.org> | 2013-02-27 23:21:34 +0100 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2013-02-27 23:21:34 +0100 |
commit | 4f5e8b7554b6388aa2d0eb4a3b285d99499163be (patch) | |
tree | df959fda79d15b5782d6a5814032d50f3174774e /gi/pygi-marshal-cleanup.c | |
parent | 70118c3840b10e1585d066a4be485c097cd23e99 (diff) | |
download | pygobject-4f5e8b7554b6388aa2d0eb4a3b285d99499163be.tar.gz |
Fix cleanup of GValue arrays
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
Diffstat (limited to 'gi/pygi-marshal-cleanup.c')
-rw-r--r-- | gi/pygi-marshal-cleanup.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gi/pygi-marshal-cleanup.c b/gi/pygi-marshal-cleanup.c index bd9522a5..50f593db 100644 --- a/gi/pygi-marshal-cleanup.c +++ b/gi/pygi-marshal-cleanup.c @@ -368,8 +368,17 @@ _pygi_marshal_cleanup_from_py_array (PyGIInvokeState *state, else if (sequence_cache->item_cache->is_pointer) item = g_array_index (array_, gpointer, i); /* case 3: C array or GArray with simple types or structs */ - else + else { item = array_->data + i * sequence_cache->item_size; + /* special-case hack: GValue array items do not get slice + * allocated in _pygi_marshal_from_py_array(), so we must + * not try to deallocate it as a slice and thus + * short-circuit cleanup_func. */ + if (cleanup_func == _pygi_marshal_cleanup_from_py_interface_struct_gvalue) { + g_value_unset ((GValue*) item); + continue; + } + } cleanup_func (state, sequence_cache->item_cache, item, TRUE); } |