summaryrefslogtreecommitdiff
path: root/python/generic.h
diff options
context:
space:
mode:
Diffstat (limited to 'python/generic.h')
-rw-r--r--python/generic.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/generic.h b/python/generic.h
index 31c1bc2d..7abf7e7a 100644
--- a/python/generic.h
+++ b/python/generic.h
@@ -202,8 +202,10 @@ void CppDeallocPtr(PyObject *iObj)
std::cerr << "=== DEALLOCATING " << iObj->ob_type->tp_name << "*+ ===\n";
#endif
CppPyObject<T> *Obj = (CppPyObject<T> *)iObj;
- if (!((CppPyObject<T>*)Obj)->NoDelete)
+ if (!((CppPyObject<T>*)Obj)->NoDelete) {
delete Obj->Object;
+ Obj->Object = NULL;
+ }
CppClear<T>(iObj);
iObj->ob_type->tp_free(iObj);
}