From 2eb66640bf27c937b7eaa91e294376c173026ad9 Mon Sep 17 00:00:00 2001 From: doomchild Date: Mon, 12 Apr 2010 14:47:11 -0500 Subject: [PATCH] added debugging messages to deallocation --- dfhack/python/DF_Material.cpp | 10 ++++++++++ dfhack/python/DF_MemInfo.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/dfhack/python/DF_Material.cpp b/dfhack/python/DF_Material.cpp index 6e4615441..6cc02cd18 100644 --- a/dfhack/python/DF_Material.cpp +++ b/dfhack/python/DF_Material.cpp @@ -166,17 +166,27 @@ static int DF_Material_init(DF_Material* self, PyObject* args, PyObject* kwds) static void DF_Material_dealloc(DF_Material* self) { + PySys_WriteStdout("material dealloc\n"); + if(self != NULL) { + PySys_WriteStdout("material not NULL\n"); + if(self->mat_Ptr != NULL) { + PySys_WriteStdout("mat_Ptr = %i\n", (int)self->mat_Ptr); + delete self->mat_Ptr; + PySys_WriteStdout("mat_Ptr deleted\n"); + self->mat_Ptr = NULL; } self->ob_type->tp_free((PyObject*)self); } + + PySys_WriteStdout("material dealloc done\n"); } // Type methods diff --git a/dfhack/python/DF_MemInfo.cpp b/dfhack/python/DF_MemInfo.cpp index 86efd35ff..4680b502e 100644 --- a/dfhack/python/DF_MemInfo.cpp +++ b/dfhack/python/DF_MemInfo.cpp @@ -63,17 +63,27 @@ static int DF_MemInfo_init(DF_MemInfo* self, PyObject* args, PyObject* kwds) static void DF_MemInfo_dealloc(DF_MemInfo* self) { + PySys_WriteStdout("mem_info dealloc\n"); + if(self != NULL) { + PySys_WriteStdout("mem_info not NULL\n"); + if(self->mem_Ptr != NULL) { + PySys_WriteStdout("mem_Ptr = %i\n", (int)self->mem_Ptr); + delete self->mem_Ptr; + PySys_WriteStdout("mem_Ptr deleted\n"); + self->mem_Ptr = NULL; } self->ob_type->tp_free((PyObject*)self); } + + PySys_WriteStdout("mem_info dealloc done\n"); } // Setters/Getters