Fix crash on exit

This commit is contained in:
Phillip Stephens 2016-02-19 21:49:47 -08:00
parent bd0a72a4cb
commit 4bfe4026f2
2 changed files with 11 additions and 7 deletions

View File

@ -15,26 +15,29 @@ struct Application : boo::IApplicationCallback
{ {
HECL::Runtime::FileStoreManager m_fileMgr; HECL::Runtime::FileStoreManager m_fileMgr;
HECL::CVarManager m_cvarManager; HECL::CVarManager m_cvarManager;
ViewManager m_viewManager; std::unique_ptr<ViewManager> m_viewManager;
bool m_running = true; bool m_running = true;
Application() : Application() :
m_fileMgr(_S("urde")), m_fileMgr(_S("urde")),
m_cvarManager(m_fileMgr), m_cvarManager(m_fileMgr)
m_viewManager(m_fileMgr, m_cvarManager) {} {
m_viewManager.reset(new ViewManager(m_fileMgr, m_cvarManager));
}
int appMain(boo::IApplication* app) int appMain(boo::IApplication* app)
{ {
initialize(app); initialize(app);
m_viewManager.init(app); m_viewManager->init(app);
while (m_running) while (m_running)
{ {
if (!m_viewManager.proc()) if (!m_viewManager->proc())
break; break;
} }
m_viewManager.stop(); m_viewManager->stop();
m_cvarManager.serialize(); m_cvarManager.serialize();
m_viewManager.reset();
return 0; return 0;
} }
void appQuitting(boo::IApplication*) void appQuitting(boo::IApplication*)

View File

@ -179,7 +179,7 @@ int CMain::appMain(boo::IApplication* app)
TOneStatic<CGameArchitectureSupport> archSupport; TOneStatic<CGameArchitectureSupport> archSupport;
boo::IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue(); boo::IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue();
float rgba[4] = { 0.5f, 0.5f, 0.5f, 1.0f}; float rgba[4] = { 0.2f, 0.2f, 0.2f, 1.0f};
gfxQ->setClearColor(rgba); gfxQ->setClearColor(rgba);
float time = 0.0f; float time = 0.0f;
@ -192,6 +192,7 @@ int CMain::appMain(boo::IApplication* app)
xe8_b24_finished = archSupport->Update(); xe8_b24_finished = archSupport->Update();
gfxQ->clearTarget(); gfxQ->clearTarget();
gfxQ->resolveDisplay(nullptr);
gfxQ->execute(); gfxQ->execute();
time = (frame++) / 60.f; time = (frame++) / 60.f;