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.
This commit is contained in:
2010-01-29 14:49:21 +00:00
parent 5abb38e566
commit e28e6ac5c7
2 changed files with 5 additions and 7 deletions

View File

@@ -217,7 +217,9 @@ static void bpy_init_modules( void )
/* bpy context */ /* bpy context */
{ {
bpy_context_module= ( BPy_StructRNA * ) PyObject_NEW( BPy_StructRNA, &pyrna_struct_Type ); bpy_context_module= ( BPy_StructRNA * ) PyObject_NEW( BPy_StructRNA, &pyrna_struct_Type );
RNA_pointer_create(NULL, &RNA_Context, NULL, &bpy_context_module->ptr); RNA_pointer_create(NULL, &RNA_Context, NULL, &bpy_context_module->ptr);
bpy_context_module->freeptr= 0;
PyModule_AddObject(mod, "context", (PyObject *)bpy_context_module); PyModule_AddObject(mod, "context", (PyObject *)bpy_context_module);
} }

View File

@@ -370,13 +370,9 @@ static long pyrna_struct_hash( BPy_StructRNA *self )
static void pyrna_struct_dealloc( BPy_StructRNA *self ) static void pyrna_struct_dealloc( BPy_StructRNA *self )
{ {
if (self->freeptr && self->ptr.data) { if (self->freeptr && self->ptr.data) {
IDP_FreeProperty(self->ptr.data);
if (self->ptr.type != &RNA_Context) 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 */ /* Note, for subclassed PyObjects we cant just call PyObject_DEL() directly or it will crash */