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.
This commit is contained in:
Tamito Kajiyama
2009-07-26 20:20:25 +00:00
parent 69853d3e40
commit 52f639277b
27 changed files with 51 additions and 27 deletions

View File

@@ -204,7 +204,7 @@ int Interface1D___init__(BPy_Interface1D *self, PyObject *args, PyObject *kwds)
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);
}