diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-26 14:33:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-26 14:33:57 +0400 |
commit | 0e6f8e3e25d9c48501c12cdb56bc78868b568ff5 (patch) | |
tree | 8633e1f31c844764a475d403a6d976e6c691dd22 /source/blender/python/intern/bpy_interface.c | |
parent | 6cc79fc3d0c55294d5e47642aae75348922d59c2 (diff) |
fix for crash when a python operator or render engine was freed in the C code and then referenced from python.
now further access in python gives an exception at the line when the freed data is accessed.
Diffstat (limited to 'source/blender/python/intern/bpy_interface.c')
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index f6ab100ca1a..39621fcf390 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -510,6 +510,18 @@ void BPY_DECREF(void *pyob_ptr) PyGILState_Release(gilstate); } +void BPY_RNA_DECREF_INVALIDATE(void *pyob_ptr) +{ + PyGILState_STATE gilstate = PyGILState_Ensure(); + const int do_invalidate = (Py_REFCNT((PyObject *)pyob_ptr) > 1); + Py_DECREF((PyObject *)pyob_ptr); + if (do_invalidate) { + pyrna_invalidate(pyob_ptr); + } + PyGILState_Release(gilstate); +} + + /* return -1 on error, else 0 */ int BPY_button_exec(bContext *C, const char *expr, double *value, const short verbose) { |