Fix segfault in CApp UT
I moved m_engine creation to the constructor. However, it is not complete until after calling m_engine->Create(). The UT segfault because the pointer is not null and destructor calls m_engine->Destroy() on an incomplete object. (Yes, UTs test incomplete SUT.) So I moved back the m_engine creation to CApp::Create() but before the SDL initialization as m_engine holds the flag for vsync.pyro-refactor
parent
9a04685101
commit
404d2dbeb1
|
@ -112,7 +112,6 @@ struct ApplicationPrivate
|
||||||
CApplication::CApplication(CSystemUtils* systemUtils)
|
CApplication::CApplication(CSystemUtils* systemUtils)
|
||||||
: m_systemUtils(systemUtils),
|
: m_systemUtils(systemUtils),
|
||||||
m_private(MakeUnique<ApplicationPrivate>()),
|
m_private(MakeUnique<ApplicationPrivate>()),
|
||||||
m_engine(MakeUnique<Gfx::CEngine>(this, m_systemUtils)),
|
|
||||||
m_configFile(MakeUnique<CConfigFile>()),
|
m_configFile(MakeUnique<CConfigFile>()),
|
||||||
m_input(MakeUnique<CInput>()),
|
m_input(MakeUnique<CInput>()),
|
||||||
m_pathManager(MakeUnique<CPathManager>(systemUtils)),
|
m_pathManager(MakeUnique<CPathManager>(systemUtils)),
|
||||||
|
@ -550,6 +549,8 @@ bool CApplication::Create()
|
||||||
|
|
||||||
/* SDL initialization sequence */
|
/* SDL initialization sequence */
|
||||||
|
|
||||||
|
// Creating the m_engine now because it holds the vsync flag
|
||||||
|
m_engine = MakeUnique<Gfx::CEngine>(this, m_systemUtils);
|
||||||
|
|
||||||
Uint32 initFlags = SDL_INIT_VIDEO | SDL_INIT_TIMER;
|
Uint32 initFlags = SDL_INIT_VIDEO | SDL_INIT_TIMER;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue