From 1dccfe6c53951307bad71403a8293524b5a679e0 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Thu, 11 Apr 2013 05:50:59 +0000 Subject: [PATCH] fixed: real server dtor being called (we forgot to set m_mock - FUUUUUUUU). also added quick and dirty backtrace for osx, since we keep accidentally calling that singleton in unit tests... could be handy, we should consider refactoring into a func maybe. --- src/lib/base/IEventQueue.cpp | 19 ++++++++++++++++++- src/test/unittests/server/CMockServer.h | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/lib/base/IEventQueue.cpp b/src/lib/base/IEventQueue.cpp index 7bcd0152..f3027acb 100644 --- a/src/lib/base/IEventQueue.cpp +++ b/src/lib/base/IEventQueue.cpp @@ -19,6 +19,12 @@ #include "IEventQueue.h" #include "CLog.h" +#if WINAPI_CARBON +#include +#include +#endif + + // // IEventQueue // @@ -36,7 +42,18 @@ IEventQueue::getSystemTarget() IEventQueue* IEventQueue::getInstance() { - LOG((CLOG_DEBUG4 "assert event queue instance")); + if (s_instance == NULL) { + LOG((CLOG_ERR "null event queue")); +#if WINAPI_CARBON + void* callstack[128]; + int i, frames = backtrace(callstack, 128); + char** strs = backtrace_symbols(callstack, frames); + for (i = 0; i < frames; ++i) { + printf("%s\n", strs[i]); + } + free(strs); +#endif + } assert(s_instance != NULL); return s_instance; } diff --git a/src/test/unittests/server/CMockServer.h b/src/test/unittests/server/CMockServer.h index ba8d5a6b..7623c240 100644 --- a/src/test/unittests/server/CMockServer.h +++ b/src/test/unittests/server/CMockServer.h @@ -27,5 +27,5 @@ class IEventQueue; class CMockServer : public CServer { public: - CMockServer() : CServer() { } + CMockServer() : CServer() { m_mock = true; } };