YaGL: Fix yagl_get_gles2_sym(...) resolution order 30/45330/1
authorVasiliy Ulyanov <v.ulyanov@samsung.com>
Tue, 9 Jun 2015 15:35:09 +0000 (18:35 +0300)
committerjinhyung.jo <jinhyung.jo@samsung.com>
Tue, 4 Aug 2015 08:27:29 +0000 (17:27 +0900)
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>
EGL/yagl_egl_state.c

index 2d96afcb1a0aed23ba42909275c71318563136c3..096dca989d6a0ab201fca3bf8a4baf6bf4bd62f8 100644 (file)
@@ -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)