Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-01-08 18:29:09 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-01-08 18:29:09 +0300
commit8140c76ac6142cd7182eacd866744017929a4a69 (patch)
tree0b41a636956ccddbec05ea9dcaf309343e956223 /source/blender/python
parentbebe874a5b80a1e698b3a9dc6aec0870540aed4b (diff)
RNA: fix crash in python code, forgot to update this part in a previous commit.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_operator.c4
-rw-r--r--source/blender/python/intern/bpy_rna.c10
-rw-r--r--source/blender/python/intern/bpy_rna.h2
3 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 061c43c4773..f800b7d0d04 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -164,7 +164,9 @@ PyObject *pyop_func_get_rna(BPy_OperatorFunc *self)
pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr); /* were not really using &ptr, overwite next */
/* XXX POINTER - if this 'ot' is python generated, it could be free'd */
- RNA_pointer_create(NULL, NULL, ot->srna, &pyrna->properties, &pyrna->ptr);
+ RNA_pointer_create(NULL, ot->srna, NULL, &pyrna->ptr);
+ pyrna->freeptr= 1;
+
return (PyObject *)pyrna;
}
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index a8409976b73..7ad40d3dcd3 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -63,10 +63,10 @@ static long pyrna_struct_hash( BPy_StructRNA * self )
static void pyrna_struct_dealloc( BPy_StructRNA * self )
{
/* Note!! for some weired reason calling PyObject_DEL() directly crashes blender! */
- if (self->properties) {
- IDP_FreeProperty(self->properties);
- MEM_freeN(self->properties);
- self->properties= NULL;
+ if (self->freeptr && self->ptr.data) {
+ IDP_FreeProperty(self->ptr.data);
+ MEM_freeN(self->ptr.data);
+ self->ptr.data= NULL;
}
((PyObject *)self)->ob_type->tp_free(self);
@@ -1135,7 +1135,7 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
}
pyrna->ptr= *ptr;
- pyrna->properties= NULL;
+ pyrna->freeptr= 0;
return ( PyObject * ) pyrna;
}
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 8f21e6d80c8..73272eac6e8 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -36,7 +36,7 @@ extern PyTypeObject pyrna_prop_Type;
typedef struct {
PyObject_VAR_HEAD /* required python macro */
PointerRNA ptr;
- IDProperty *properties; /* needed in some cases for RNA_pointer_create(), free when deallocing */
+ int freeptr; /* needed in some cases if ptr.data is created on the fly, free when deallocing */
} BPy_StructRNA;
typedef struct {