should delete DrawerYG on OpenGL thread as there could be OpenGL calls.

This commit is contained in:
rachytski 2012-02-07 17:49:04 +04:00 committed by Alex Zolotarev
parent 06c5e96697
commit 6812b25242
2 changed files with 9 additions and 4 deletions

View file

@ -25,6 +25,7 @@ TileRenderer::TileRenderer(
double visualScale,
yg::gl::PacketsQueue ** packetsQueues
) : m_queue(executorsCount),
m_executorsCount(executorsCount),
m_tileCache(maxTilesCount - executorsCount - 1),
m_renderFn(renderFn),
m_skinName(skinName),
@ -42,7 +43,7 @@ TileRenderer::TileRenderer(
int tileWidth = m_resourceManager->params().m_renderTargetTexturesParams.m_texWidth;
int tileHeight = m_resourceManager->params().m_renderTargetTexturesParams.m_texHeight;
for (unsigned i = 0; i < m_queue.ExecutorsCount(); ++i)
for (unsigned i = 0; i < m_executorsCount; ++i)
{
DrawerYG::params_t params;
@ -81,7 +82,12 @@ TileRenderer::TileRenderer(
TileRenderer::~TileRenderer()
{
m_isExiting = true;
m_queue.Cancel();
for (size_t i = 0; i < m_executorsCount; ++i)
if (m_threadData[i].m_drawer)
delete m_threadData[i].m_drawer;
}
void TileRenderer::InitializeThreadGL(core::CommandsQueue::Environment const & env)
@ -102,9 +108,6 @@ void TileRenderer::FinalizeThreadGL(core::CommandsQueue::Environment const & env
{
ThreadData & threadData = m_threadData[env.threadNum()];
if (threadData.m_drawer != 0)
delete threadData.m_drawer;
if (threadData.m_renderContext)
threadData.m_renderContext->endThreadDrawing();
}

View file

@ -34,6 +34,8 @@ protected:
core::CommandsQueue m_queue;
size_t m_executorsCount;
shared_ptr<yg::ResourceManager> m_resourceManager;
struct ThreadData