Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f087c828 authored by ywen's avatar ywen Committed by Digish Pandya
Browse files

Fix a GL error leak issue

glFinish() dequeues a native buffer, and it fails when
the bufeer has been abandoned, this is ok and will not
casue the app crash

GL_OUT_OF_MEMORY is generated in this case, and it is
not reset until glGetError called. This is happened in
build layer function, glGetError is called after glTexImg2d,
and get GL_OUT_OF_MEMORY, then this function return as OOM,
and app crash

Fix it by adding a glGetError after glFinish

Change-Id: I8803a726b6f609c4a2f8a6aa6bb7ff7064808932
parent 34a63ba4
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@
#include "LayerRenderer.h"
#include "LayerRenderer.h"
#include "ShadowTessellator.h"
#include "ShadowTessellator.h"
#include "RenderState.h"
#include "RenderState.h"
#include "utils/GLUtils.h"


namespace android {
namespace android {


@@ -368,6 +369,12 @@ void Caches::flush(FlushMode mode) {


    clearGarbage();
    clearGarbage();
    glFinish();
    glFinish();

    // glFinish() need dequeue buffer, and it is not 100% success
    // It generates gl error sometimes, this error will be there
    // until glGetError called. Call GLUtils::dumpGLErrors to clean
    // the error in case it leaks to other functions
    GLUtils::dumpGLErrors();
}
}


///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////