From 52f639277b527b97eb29f3f91e0f5899fd30d8a2 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sun, 26 Jul 2009 20:20:25 +0000 Subject: 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. --- .../intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp') diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index ac5b1257167..543d6dc57a7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -140,7 +140,8 @@ int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature* self) void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature* self) { - delete self->uf0D_edgenature; + if (self->uf0D_edgenature) + delete self->uf0D_edgenature; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } -- cgit v1.2.3