Fix the underlying problem from the last commit, which was worked
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 29 Jan 2010 14:49:21 +0000 (14:49 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 29 Jan 2010 14:49:21 +0000 (14:49 +0000)
around incorrectly in r24435 before that. freeptr in BPy_StructRNA
was uninitialized when creating bpy.context.

source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_rna.c

index 1591f491944f182f4f5e983199180fcd695f035e..58f271a5e77027c835a82972d7ae1a1e81fe20ff 100644 (file)
@@ -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);
        }
index 9e34da1dde7c6bc0ce054e7d9d5707e8790f2b9f..49dfa95109c6d9cf9bf4ee8dfbafd305edce5109 100644 (file)
@@ -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 */