Merge pull request #1140 from rokuz/fixed-crash-on-exit

Fixed crash on destroy drape engine
This commit is contained in:
Alex Zolotarev 2015-12-25 13:49:26 +03:00
commit 27b07466fe
2 changed files with 8 additions and 5 deletions

View file

@ -137,7 +137,8 @@ void BaseRenderer::ProcessStopRenderingMessage()
bool BaseRenderer::CanReceiveMessages()
{
return !m_selfThread.GetRoutine()->IsCancelled();
threads::IRoutine * routine = m_selfThread.GetRoutine();
return routine != nullptr && !routine->IsCancelled();
}
} // namespace df

View file

@ -82,15 +82,17 @@ DrapeEngine::DrapeEngine(Params && params)
DrapeEngine::~DrapeEngine()
{
// Call Teardown and reset pointers explicitly! We must wait for threads completion.
// Call Teardown explicitly! We must wait for threads completion.
m_frontend->Teardown();
m_frontend.reset();
m_backend->Teardown();
m_backend.reset();
// Reset thread commutator, it stores BaseRenderer pointers.
m_threadCommutator.reset();
// Reset pointers to FrontendRenderer and BackendRenderer.
m_frontend.reset();
m_backend.reset();
gui::DrapeGui::Instance().Destroy();
m_textureManager->Release();
}