From dabe4ab4dcdee3b9224df5089c16e323c1a29122 Mon Sep 17 00:00:00 2001 From: hanyuhang Date: Thu, 5 Nov 2020 19:12:15 +0800 Subject: [PATCH] solve problem:qq crash in glEnableClientState --- android/opengl/system/GLESv1/gl.cpp | 1 + android/opengl/system/GLESv1_enc/gl_entry.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/android/opengl/system/GLESv1/gl.cpp b/android/opengl/system/GLESv1/gl.cpp index 8aaf347..b0ae70e 100644 --- a/android/opengl/system/GLESv1/gl.cpp +++ b/android/opengl/system/GLESv1/gl.cpp @@ -27,6 +27,7 @@ //XXX: fix this macro to get the context from fast tls path #define GET_CONTEXT GLEncoder * ctx = getEGLThreadInfo()->hostConn->glEncoder(); +#define GET_CONTEXT_CHECK ALOGD("GET_CONTEXT_CHECK for compile"); #include "gl_entry.cpp" diff --git a/android/opengl/system/GLESv1_enc/gl_entry.cpp b/android/opengl/system/GLESv1_enc/gl_entry.cpp index 2b7fa9f..05c384f 100644 --- a/android/opengl/system/GLESv1_enc/gl_entry.cpp +++ b/android/opengl/system/GLESv1_enc/gl_entry.cpp @@ -3,6 +3,7 @@ #include #include #include "gl_client_context.h" +#include #ifndef GL_TRUE extern "C" { @@ -304,6 +305,11 @@ extern "C" { static gl_client_context_t::CONTEXT_ACCESSOR_TYPE *getCurrentContext = NULL; void gl_client_context_t::setContextAccessor(CONTEXT_ACCESSOR_TYPE *f) { getCurrentContext = f; } #define GET_CONTEXT gl_client_context_t * ctx = getCurrentContext() +#define GET_CONTEXT_CHECK \ + if (getCurrentContext == NULL) { \ + ALOGE("GET_CONTEXT_CHECK getCurrentContext == NULL!!!"); \ + return; \ + } #endif void glAlphaFunc(GLenum func, GLclampf ref) @@ -724,6 +730,7 @@ void glEnable(GLenum cap) void glEnableClientState(GLenum array) { + GET_CONTEXT_CHECK; GET_CONTEXT; ctx->glEnableClientState(ctx, array); } -- Gitee