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.

This commit is contained in:
Nick Bolton 2013-04-11 05:50:59 +00:00
parent 34d52c8af4
commit 1dccfe6c53
2 changed files with 19 additions and 2 deletions

View File

@ -19,6 +19,12 @@
#include "IEventQueue.h" #include "IEventQueue.h"
#include "CLog.h" #include "CLog.h"
#if WINAPI_CARBON
#include <execinfo.h>
#include <stdio.h>
#endif
// //
// IEventQueue // IEventQueue
// //
@ -36,7 +42,18 @@ IEventQueue::getSystemTarget()
IEventQueue* IEventQueue*
IEventQueue::getInstance() 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); assert(s_instance != NULL);
return s_instance; return s_instance;
} }

View File

@ -27,5 +27,5 @@ class IEventQueue;
class CMockServer : public CServer class CMockServer : public CServer
{ {
public: public:
CMockServer() : CServer() { } CMockServer() : CServer() { m_mock = true; }
}; };