[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21937] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/python: Second attempt to fix a null pointer reference in deallocators of
Tamito Kajiyama
rd6t-kjym at asahi-net.or.jp
Sun Jul 26 22:20:25 CEST 2009
Revision: 21937
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21937
Author: kjym3
Date: 2009-07-26 22:20:25 +0200 (Sun, 26 Jul 2009)
Log Message:
-----------
Second attempt to fix a null pointer reference in deallocators of
built-in types (the first was in revision 21877). When an exception
has raised within from the __init__ method of a user-defined class
derived from a built-in type (e.g., UnaryPredicate0D and
BinaryPredicate1D), some member variables of the base type are
left uninitialized, leading to a null pointer reference in the
"__dealloc__" function in the base type. To avoid this, pointer
checking was added in the deallocators of those built-in types that
can be used to define a subclass by a user.
Revision Links:
--------------
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21877
Modified Paths:
--------------
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -133,7 +133,8 @@
void BinaryPredicate0D___dealloc__(BPy_BinaryPredicate0D* self)
{
- delete self->bp0D;
+ if (self->bp0D)
+ delete self->bp0D;
self->ob_type->tp_free((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -164,7 +164,8 @@
void BinaryPredicate1D___dealloc__(BPy_BinaryPredicate1D* self)
{
- delete self->bp1D;
+ if (self->bp1D)
+ delete self->bp1D;
self->ob_type->tp_free((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface0D.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface0D.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -189,7 +189,7 @@
void Interface0D___dealloc__(BPy_Interface0D* self)
{
- if( self->if0D->py_if0D )
+ if( self->if0D && self->if0D->py_if0D )
delete self->if0D;
self->ob_type->tp_free((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface1D.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface1D.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -204,7 +204,7 @@
void Interface1D___dealloc__(BPy_Interface1D* self)
{
- if( self->if1D->py_if1D )
+ if( self->if1D && self->if1D->py_if1D )
delete self->if1D;
self->ob_type->tp_free((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -193,7 +193,8 @@
void Iterator___dealloc__(BPy_Iterator* self)
{
- delete self->it;
+ if (self->it)
+ delete self->it;
self->ob_type->tp_free((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -208,7 +208,7 @@
void StrokeAttribute___dealloc__(BPy_StrokeAttribute* self)
{
- if( self->sa->py_sa )
+ if( self->sa && self->sa->py_sa )
delete self->sa;
self->ob_type->tp_free((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -266,7 +266,8 @@
void StrokeShader___dealloc__(BPy_StrokeShader* self)
{
- delete self->ss;
+ if (self->ss)
+ delete self->ss;
self->ob_type->tp_free((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -144,7 +144,8 @@
void UnaryPredicate0D___dealloc__(BPy_UnaryPredicate0D* self)
{
- delete self->up0D;
+ if (self->up0D)
+ delete self->up0D;
self->ob_type->tp_free((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -186,7 +186,8 @@
void UnaryPredicate1D___dealloc__(BPy_UnaryPredicate1D* self)
{
- delete self->up1D;
+ if (self->up1D)
+ delete self->up1D;
self->ob_type->tp_free((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -197,7 +197,8 @@
void UnaryFunction0DDouble___dealloc__(BPy_UnaryFunction0DDouble* self)
{
- delete self->uf0D_double;
+ if (self->uf0D_double)
+ delete self->uf0D_double;
UnaryFunction0D_Type.tp_dealloc((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -140,7 +140,8 @@
void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature* self)
{
- delete self->uf0D_edgenature;
+ if (self->uf0D_edgenature)
+ delete self->uf0D_edgenature;
UnaryFunction0D_Type.tp_dealloc((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -169,7 +169,8 @@
void UnaryFunction0DFloat___dealloc__(BPy_UnaryFunction0DFloat* self)
{
- delete self->uf0D_float;
+ if (self->uf0D_float)
+ delete self->uf0D_float;
UnaryFunction0D_Type.tp_dealloc((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -140,7 +140,8 @@
void UnaryFunction0DId___dealloc__(BPy_UnaryFunction0DId* self)
{
- delete self->uf0D_id;
+ if (self->uf0D_id)
+ delete self->uf0D_id;
UnaryFunction0D_Type.tp_dealloc((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -140,7 +140,8 @@
void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial* self)
{
- delete self->uf0D_material;
+ if (self->uf0D_material)
+ delete self->uf0D_material;
UnaryFunction0D_Type.tp_dealloc((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp 2009-07-26 19:23:07 UTC (rev 21936)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp 2009-07-26 20:20:25 UTC (rev 21937)
@@ -140,7 +140,8 @@
void UnaryFunction0DUnsigned___dealloc__(BPy_UnaryFunction0DUnsigned* self)
{
- delete self->uf0D_unsigned;
+ if (self->uf0D_unsigned)
+ delete self->uf0D_unsigned;
UnaryFunction0D_Type.tp_dealloc((PyObject*)self);
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp 2009-07-26 19:23:07 UTC (rev 21936)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list