diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-29 17:49:21 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-29 17:49:21 +0300 |
commit | e28e6ac5c78d6f02e43132f9f5d23288f151be12 (patch) | |
tree | 0254692a5193e5605f6a7a903cc5c152e8b5218f /source/blender/python | |
parent | 5abb38e566774054f586fd4ac6a1d42c951d3213 (diff) |
Fix the underlying problem from the last commit, which was worked
around incorrectly in r24435 before that. freeptr in BPy_StructRNA
was uninitialized when creating bpy.context.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 1591f491944..58f271a5e77 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -217,7 +217,9 @@ static void bpy_init_modules( void ) /* bpy context */ { bpy_context_module= ( BPy_StructRNA * ) PyObject_NEW( BPy_StructRNA, &pyrna_struct_Type ); + RNA_pointer_create(NULL, &RNA_Context, NULL, &bpy_context_module->ptr); + bpy_context_module->freeptr= 0; PyModule_AddObject(mod, "context", (PyObject *)bpy_context_module); } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 9e34da1dde7..49dfa95109c 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -370,13 +370,9 @@ static long pyrna_struct_hash( BPy_StructRNA *self ) static void pyrna_struct_dealloc( BPy_StructRNA *self ) { if (self->freeptr && self->ptr.data) { - - if (self->ptr.type != &RNA_Context) - { - IDP_FreeProperty(self->ptr.data); - MEM_freeN(self->ptr.data); - self->ptr.data= NULL; - } + IDP_FreeProperty(self->ptr.data); + MEM_freeN(self->ptr.data); + self->ptr.data= NULL; } /* Note, for subclassed PyObjects we cant just call PyObject_DEL() directly or it will crash */ |