mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-09 06:04:03 +00:00
gl_engine: hotfix memory leak
issue: https://github.com/thorvg/thorvg/issues/3140
This commit is contained in:
parent
5752e75ff9
commit
b79d12a04d
2 changed files with 9 additions and 6 deletions
|
@ -45,7 +45,7 @@ static void _termEngine()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GlRenderer::flush()
|
void GlRenderer::clearDisposes()
|
||||||
{
|
{
|
||||||
if (mDisposed.textures.count > 0) {
|
if (mDisposed.textures.count > 0) {
|
||||||
glDeleteTextures(mDisposed.textures.count, mDisposed.textures.data);
|
glDeleteTextures(mDisposed.textures.count, mDisposed.textures.data);
|
||||||
|
@ -53,19 +53,21 @@ void GlRenderer::flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
ARRAY_FOREACH(p, mRenderPassStack) delete(*p);
|
ARRAY_FOREACH(p, mRenderPassStack) delete(*p);
|
||||||
|
|
||||||
mRenderPassStack.clear();
|
mRenderPassStack.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GlRenderer::flush()
|
||||||
|
{
|
||||||
|
clearDisposes();
|
||||||
|
|
||||||
ARRAY_FOREACH(p, mComposePool) delete(*p);
|
ARRAY_FOREACH(p, mComposePool) delete(*p);
|
||||||
|
|
||||||
mComposePool.clear();
|
mComposePool.clear();
|
||||||
|
|
||||||
ARRAY_FOREACH(p, mBlendPool) delete(*p);
|
ARRAY_FOREACH(p, mBlendPool) delete(*p);
|
||||||
|
|
||||||
mBlendPool.clear();
|
mBlendPool.clear();
|
||||||
|
|
||||||
ARRAY_FOREACH(p, mComposeStack) delete(*p);
|
ARRAY_FOREACH(p, mComposeStack) delete(*p);
|
||||||
|
|
||||||
mComposeStack.clear();
|
mComposeStack.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -850,7 +852,7 @@ bool GlRenderer::sync()
|
||||||
|
|
||||||
GL_CHECK(glDisable(GL_SCISSOR_TEST));
|
GL_CHECK(glDisable(GL_SCISSOR_TEST));
|
||||||
|
|
||||||
flush();
|
clearDisposes();
|
||||||
|
|
||||||
delete task;
|
delete task;
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,7 @@ private:
|
||||||
void endRenderPass(RenderCompositor* cmp);
|
void endRenderPass(RenderCompositor* cmp);
|
||||||
|
|
||||||
void flush();
|
void flush();
|
||||||
|
void clearDisposes();
|
||||||
void currentContext();
|
void currentContext();
|
||||||
|
|
||||||
void* mContext = nullptr;
|
void* mContext = nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue