Fixes #2583, clean up EGL initialization
authorGabriel Jacobo <gabomdq@gmail.com>
Mon, 16 Jun 2014 09:47:23 -0300
changeset 88725a6375d96834
parent 8871 e7abd1102676
child 8873 77ffe680093f
Fixes #2583, clean up EGL initialization
src/video/SDL_egl.c
     1.1 --- a/src/video/SDL_egl.c	Sun Jun 15 19:32:39 2014 -0700
     1.2 +++ b/src/video/SDL_egl.c	Mon Jun 16 09:47:23 2014 -0300
     1.3 @@ -189,7 +189,7 @@
     1.4          dll_handle = SDL_LoadObject(egl_path);
     1.5      }   
     1.6      /* Try loading a EGL symbol, if it does not work try the default library paths */
     1.7 -    if (SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
     1.8 +    if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
     1.9          if (dll_handle != NULL) {
    1.10              SDL_UnloadObject(dll_handle);
    1.11          }
    1.12 @@ -198,7 +198,10 @@
    1.13              path = DEFAULT_EGL;
    1.14          }
    1.15          dll_handle = SDL_LoadObject(path);
    1.16 -        if (dll_handle == NULL) {
    1.17 +        if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
    1.18 +            if (dll_handle != NULL) {
    1.19 +                SDL_UnloadObject(dll_handle);
    1.20 +            }
    1.21              return SDL_SetError("Could not load EGL library");
    1.22          }
    1.23          SDL_ClearError();
    1.24 @@ -235,8 +238,6 @@
    1.25      }
    1.26  #endif
    1.27  
    1.28 -    _this->egl_data->dll_handle = dll_handle;
    1.29 -    _this->egl_data->egl_dll_handle = egl_dll_handle;
    1.30      _this->gl_config.driver_loaded = 1;
    1.31  
    1.32      if (path) {