From 6db82da9b9c563ca34dbcd6ea0f5b01b438d8d0f Mon Sep 17 00:00:00 2001 From: twwang Date: Mon, 19 Oct 2020 23:17:35 +0800 Subject: [PATCH] fix colorBuffer-memLeak --- src/anbox/graphics/emugl/Renderer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/anbox/graphics/emugl/Renderer.cpp b/src/anbox/graphics/emugl/Renderer.cpp index a1e4228..cc8ddcb 100644 --- a/src/anbox/graphics/emugl/Renderer.cpp +++ b/src/anbox/graphics/emugl/Renderer.cpp @@ -107,7 +107,7 @@ void Renderer::resumeColorBuffer(ColorBufferRef* cbRef) { return; } if (cbRef->closedTs != 0 && eraseDelayedCloseColorBufferLocked(cbRef->cb->getHndl(), cbRef->closedTs)) { - cbRef->refcount++; + cbRef->refcount = 1; cbRef->closedTs = 0; int tid = tInfo->m_tid; if (tid > 0) { @@ -636,7 +636,7 @@ void Renderer::closeColorBufferLocked(HandleType p_colorbuffer, bool wannaClean) // to give guest a notice yet) return; } - if (--(*c).second.refcount == 0) { + if ((*c).second.refcount > 0 && --(*c).second.refcount == 0) { c->second.closedTs = getCurrentLocalTimeStamp(); m_colorBufferDelayedCloseList.push_back( {c->second.closedTs, p_colorbuffer}); -- Gitee