diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-03 12:16:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-03 12:16:06 +0300 |
commit | b6b77b8426318a8f02f3f01c8cd9abe799843470 (patch) | |
tree | 2c0f9af708583e615edc0dab0d3ec55b7a49ae5d /source/blender/python/intern/bpy_rna.h | |
parent | 57436f3013998ffff24625d5c8bf96e865fbe022 (diff) |
Py/RNA api:
fix for crash when iterating over a collection which allocates the collection and frees on when finished.
The ability for BPy_StructRNA to hold a reference to other PyObject's was added to support this.
Diffstat (limited to 'source/blender/python/intern/bpy_rna.h')
-rw-r--r-- | source/blender/python/intern/bpy_rna.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 9c2b2b62ff8..b5da9bf91be 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -40,6 +40,9 @@ /* different method */ //#define USE_PYRNA_INVALIDATE_WEAKREF +/* support for inter references, currently only needed for corner case */ +// #define USE_PYRNA_STRUCT_REFERENCE + /* use real collection iterators rather then faking with a list */ #define USE_PYRNA_ITER @@ -90,6 +93,11 @@ typedef struct { PyObject *in_weakreflist; #endif PointerRNA ptr; +#ifdef USE_PYRNA_STRUCT_REFERENCE + /* generic PyObject we hold a reference to, example use: + * hold onto the collection iterator to prevent it from freeing allocated data we may use */ + PyObject *reference; +#endif /* !USE_PYRNA_STRUCT_REFERENCE */ int freeptr; /* needed in some cases if ptr.data is created on the fly, free when deallocing */ } BPy_StructRNA; |