Skip to content

Commit

Permalink
Fixed bug 3529 - SDL_EGL_UnloadLibrary is not called at all on SDL_Quit
Browse files Browse the repository at this point in the history
kaisyu

In case of OpenGLES, the sequences of loading and unloading driver library should be like that:

SDL_Init
  ...
  SDL_GL_LoadLibrary
    SDL_EGL_LoadLibrary
...
SDL_Quit
  ...
  SDL_GL_UnloadLibrary
    SDL_EGL_UnloadLibrary
...


However, according to my test results, the varible '_this->gl_config.driver_loaded' does not allow 'SDL_GL_UnloadLibrary' to call 'SDL_EGL_UnloadLibrary'.
  • Loading branch information
slouken committed Jan 2, 2017
1 parent 0cfa0aa commit 67ed894
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/video/SDL_egl.c
Expand Up @@ -313,8 +313,6 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa
}
#endif

_this->gl_config.driver_loaded = 1;

if (path) {
SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1);
} else {
Expand Down
15 changes: 4 additions & 11 deletions src/video/directfb/SDL_DirectFB_opengl.c
Expand Up @@ -133,7 +133,6 @@ DirectFB_GL_LoadLibrary(_THIS, const char *path)
SDL_DFB_DEBUG("Loaded library: %s\n", path);

_this->gl_config.dll_handle = handle;
_this->gl_config.driver_loaded = 1;
if (path) {
SDL_strlcpy(_this->gl_config.driver_path, path,
SDL_arraysize(_this->gl_config.driver_path));
Expand All @@ -151,16 +150,10 @@ static void
DirectFB_GL_UnloadLibrary(_THIS)
{
#if 0
int ret;

if (_this->gl_config.driver_loaded) {

ret = GL_UnloadObject(_this->gl_config.dll_handle);
if (ret)
SDL_DFB_ERR("Error #%d trying to unload library.\n", ret);
_this->gl_config.dll_handle = NULL;
_this->gl_config.driver_loaded = 0;
}
int ret = GL_UnloadObject(_this->gl_config.dll_handle);
if (ret)
SDL_DFB_ERR("Error #%d trying to unload library.\n", ret);
_this->gl_config.dll_handle = NULL;
#endif
/* Free OpenGL memory */
SDL_free(_this->gl_data);
Expand Down
2 changes: 0 additions & 2 deletions src/video/emscripten/SDL_emscriptenopengles.c
Expand Up @@ -70,8 +70,6 @@ Emscripten_GLES_LoadLibrary(_THIS, const char *path) {
return SDL_SetError("Could not initialize EGL");
}

_this->gl_config.driver_loaded = 1;

if (path) {
SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1);
} else {
Expand Down
4 changes: 0 additions & 4 deletions src/video/psp/SDL_pspgl.c
Expand Up @@ -47,10 +47,6 @@
int
PSP_GL_LoadLibrary(_THIS, const char *path)
{
if (!_this->gl_config.driver_loaded) {
_this->gl_config.driver_loaded = 1;
}

return 0;
}

Expand Down

0 comments on commit 67ed894

Please sign in to comment.