Fixes #2583, clean up EGL initialization
authorGabriel Jacobo <gabomdq@gmail.com>
Mon, 16 Jun 2014 09:47:23 -0300
changeset 8872 5a6375d96834
parent 8871 e7abd1102676
child 8873 77ffe680093f
Fixes #2583, clean up EGL initialization
src/video/SDL_egl.c
--- a/src/video/SDL_egl.c	Sun Jun 15 19:32:39 2014 -0700
+++ b/src/video/SDL_egl.c	Mon Jun 16 09:47:23 2014 -0300
@@ -189,7 +189,7 @@
         dll_handle = SDL_LoadObject(egl_path);
     }   
     /* Try loading a EGL symbol, if it does not work try the default library paths */
-    if (SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
+    if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
         if (dll_handle != NULL) {
             SDL_UnloadObject(dll_handle);
         }
@@ -198,7 +198,10 @@
             path = DEFAULT_EGL;
         }
         dll_handle = SDL_LoadObject(path);
-        if (dll_handle == NULL) {
+        if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
+            if (dll_handle != NULL) {
+                SDL_UnloadObject(dll_handle);
+            }
             return SDL_SetError("Could not load EGL library");
         }
         SDL_ClearError();
@@ -235,8 +238,6 @@
     }
 #endif
 
-    _this->egl_data->dll_handle = dll_handle;
-    _this->egl_data->egl_dll_handle = egl_dll_handle;
     _this->gl_config.driver_loaded = 1;
 
     if (path) {