summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasiliy Ulyanov <v.ulyanov@samsung.com>2015-06-09 18:35:09 +0300
committerjinhyung.jo <jinhyung.jo@samsung.com>2015-08-04 17:27:29 +0900
commitbee7ea68c0d17fb66884f9639c882bffbccc1be0 (patch)
treeffc6a1bdc8ab7d64931e635f989031d76cedc52b
parenta301461bf11227af92e356750c6a4d912c4f5bb6 (diff)
downloademulator-yagl-bee7ea68c0d17fb66884f9639c882bffbccc1be0.tar.gz
emulator-yagl-bee7ea68c0d17fb66884f9639c882bffbccc1be0.tar.bz2
emulator-yagl-bee7ea68c0d17fb66884f9639c882bffbccc1be0.zip
YaGL: Fix yagl_get_gles2_sym(...) resolution order
dlsym(NULL, ...) may return a valid pointer to a local symbol. We need to search it in libGLESv2 explicitly first. Change-Id: I6200679d7b69444798d3feeb77b685e2772eb3a7 Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
-rw-r--r--EGL/yagl_egl_state.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/EGL/yagl_egl_state.c b/EGL/yagl_egl_state.c
index 2d96afc..096dca9 100644
--- a/EGL/yagl_egl_state.c
+++ b/EGL/yagl_egl_state.c
@@ -82,11 +82,7 @@ void *yagl_get_gles1_sym(const char *name)
void *yagl_get_gles2_sym(const char *name)
{
void *handle;
- void *sym = dlsym(NULL, name);
-
- if (sym) {
- return sym;
- }
+ void *sym = NULL;
handle = dlopen("libGLESv2.so.1", RTLD_NOW|RTLD_GLOBAL);
if (!handle) {
@@ -94,10 +90,14 @@ void *yagl_get_gles2_sym(const char *name)
}
if (handle) {
- return dlsym(handle, name);
+ sym = dlsym(handle, name);
}
- return NULL;
+ if (!sym) {
+ sym = dlsym(NULL, name);
+ }
+
+ return sym;
}
static void yagl_egl_state_free(void* ptr)