Fix crash in the unit tests

fixes #7769
This commit is contained in:
Gunnar Beutner 2014-12-04 21:45:15 +01:00
parent a134882567
commit 7d93788650
4 changed files with 21 additions and 12 deletions

View File

@ -108,7 +108,7 @@ void Application::Exit(int rc)
logger->Flush();
}
Timer::Uninitialize();
UninitializeBase();
#ifdef _DEBUG
exit(rc);
@ -149,6 +149,18 @@ void Application::InitializeBase(void)
#endif /* _WIN32 */
Utility::ExecuteDeferredInitializers();
/* make sure the thread pool gets initialized */
GetTP();
Timer::Initialize();
}
void Application::UninitializeBase(void)
{
Timer::Uninitialize();
GetTP().Stop();
}
/**
@ -316,12 +328,7 @@ mainloop:
DynamicObject::StopObjects();
Application::GetInstance()->OnShutdown();
#ifdef _DEBUG
GetTP().Stop();
m_ShuttingDown = false;
Timer::Uninitialize();
#endif /* _DEBUG */
UninitializeBase();
}
void Application::OnShutdown(void)

View File

@ -43,6 +43,7 @@ public:
~Application(void);
static void InitializeBase(void);
static void UninitializeBase(void);
static Application::Ptr GetInstance(void);

View File

@ -52,9 +52,6 @@ public:
boost::signals2::signal<void(const Timer::Ptr&)> OnTimerExpired;
static void Initialize(void);
static void Uninitialize(void);
class Holder {
public:
Holder(Timer *timer)
@ -88,6 +85,11 @@ private:
void Call();
static void TimerThreadProc(void);
static void Initialize(void);
static void Uninitialize(void);
friend class Application;
};
}

View File

@ -31,12 +31,11 @@ struct InitLibBase
InitLibBase(void)
{
Application::InitializeBase();
Timer::Initialize();
}
~InitLibBase(void)
{
Timer::Uninitialize();
Application::UninitializeBase();
}
};