From 93a78a57ada6d5dab410c2bd3c4b02f4fa15684c Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 18 Oct 2009 01:40:26 +0000 Subject: [PATCH 1/1] Add more debug logging of object lifetimes git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11900 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/logger.h | 1 + src/base.cpp | 12 ++++++++++-- src/inspircd.cpp | 8 +++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/logger.h b/include/logger.h index 37020a4ff..709d00aed 100644 --- a/include/logger.h +++ b/include/logger.h @@ -157,6 +157,7 @@ class CoreExport LogManager : public classbase { if (noforkstream) delete noforkstream; + Logging = true; } /** Sets up the logstream for -nofork. Called by InspIRCd::OpenLog() and LogManager::OpenFileLogs(). diff --git a/src/base.cpp b/src/base.cpp index 2e2dbfb28..15a642eb4 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -11,24 +11,32 @@ * --------------------------------------------------- */ -/* $Core */ - #include "inspircd_config.h" #include "base.h" #include #include "inspircd.h" +#include classbase::classbase() { + if (ServerInstance && ServerInstance->Logs) + ServerInstance->Logs->Log("CULLLIST", DEBUG, "classbase::+%s @%p", + typeid(*this).name(), (void*)this); } CullResult classbase::cull() { + if (ServerInstance && ServerInstance->Logs) + ServerInstance->Logs->Log("CULLLIST", DEBUG, "classbase::-%s @%p", + typeid(*this).name(), (void*)this); return CullResult(); } classbase::~classbase() { + if (ServerInstance && ServerInstance->Logs) + ServerInstance->Logs->Log("CULLLIST", DEBUG, "classbase::~%s @%p", + typeid(*this).name(), (void*)this); } CullResult::CullResult() diff --git a/src/inspircd.cpp b/src/inspircd.cpp index c59109724..862aa31d0 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -83,11 +83,9 @@ const char* ExitCodes[] = template static void DeleteZero(T*&n) { - if (n != NULL) - { - delete n; - n = NULL; - } + T* t = n; + n = NULL; + delete t; } void InspIRCd::Cleanup() -- 2.39.2