added debugging messages to deallocation

develop
doomchild 2010-04-12 14:46:04 -05:00
parent ecb2aefba1
commit e9c592b5dd
2 changed files with 30 additions and 5 deletions

@ -86,22 +86,37 @@ static int DF_API_init(DF_API* self, PyObject* args, PyObject* kwds)
static void DF_API_dealloc(DF_API* self) static void DF_API_dealloc(DF_API* self)
{ {
PySys_WriteStdout("API dealloc\n");
if(self != NULL) if(self != NULL)
{ {
Py_CLEAR(self->mem_info); PySys_WriteStdout("creature xdecref\n");
Py_CLEAR(self->position); Py_XDECREF(self->creature);
Py_CLEAR(self->material);
Py_CLEAR(self->creature); PySys_WriteStdout("mem_info xdecref\n");
Py_XDECREF(self->mem_info);
PySys_WriteStdout("position xdecref\n");
Py_XDECREF(self->position);
PySys_WriteStdout("material xdecref\n");
Py_XDECREF(self->material);
if(self->api_Ptr != NULL) if(self->api_Ptr != NULL)
{ {
PySys_WriteStdout("api_Ptr = %i\n", (int)self->api_Ptr);
delete self->api_Ptr; delete self->api_Ptr;
PySys_WriteStdout("api_Ptr deleted\n");
self->api_Ptr = NULL; self->api_Ptr = NULL;
} }
self->ob_type->tp_free((PyObject*)self); self->ob_type->tp_free((PyObject*)self);
} }
PySys_WriteStdout("API dealloc done\n");
} }
// Accessors // Accessors

@ -59,17 +59,27 @@ static int DF_CreatureManager_init(DF_CreatureManager* self, PyObject* args, PyO
static void DF_CreatureManager_dealloc(DF_CreatureManager* self) static void DF_CreatureManager_dealloc(DF_CreatureManager* self)
{ {
PySys_WriteStdout("creature manager dealloc\n");
if(self != NULL) if(self != NULL)
{ {
PySys_WriteStdout("creature manager not NULL\n");
if(self->creature_Ptr != NULL) if(self->creature_Ptr != NULL)
{ {
PySys_WriteStdout("creature_Ptr = %i\n", (int)self->creature_Ptr);
delete self->creature_Ptr; delete self->creature_Ptr;
PySys_WriteStdout("creature_Ptr deleted\n");
self->creature_Ptr = NULL; self->creature_Ptr = NULL;
} }
self->ob_type->tp_free((PyObject*)self); self->ob_type->tp_free((PyObject*)self);
} }
PySys_WriteStdout("creature manager dealloc done\n");
} }
// Type methods // Type methods