egl: Release per-thread resources before unloading (#3337)

Release EGL's per-thread resources before unloading the EGL library to
avoid a potential crash when the render thread is terminated.

Co-authored-by: Sami Kyöstilä <sami.kyostila@unrealvoodoo.org>
This commit is contained in:
Sami Kyöstilä 2024-08-09 03:36:45 +10:00 committed by GitHub
parent 409fbc5d14
commit 85726bcb53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -71,6 +71,7 @@ namespace bgfx { namespace gl
EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); \ EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); \
EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); \ EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); \
EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); \ EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); \
EGL_IMPORT_FUNC(PFNEGLRELEASETHREADPROC, eglReleaseThread); \
EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers); \ EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers); \
EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \ EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \
EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate); \ EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate); \
@ -433,6 +434,7 @@ EGL_IMPORT
m_context = NULL; m_context = NULL;
} }
EGL_CHECK(eglReleaseThread() );
eglClose(m_eglLibrary); eglClose(m_eglLibrary);
# if BX_PLATFORM_RPI # if BX_PLATFORM_RPI