Skip to content

Commit

Permalink
egl: Release per-thread resources before unloading (#3337)
Browse files Browse the repository at this point in the history
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ä <[email protected]>
  • Loading branch information
skyostil and Sami Kyöstilä authored Aug 8, 2024
1 parent 409fbc5 commit 85726bc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/glcontext_egl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ namespace bgfx { namespace gl
EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); \
EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); \
EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); \
EGL_IMPORT_FUNC(PFNEGLRELEASETHREADPROC, eglReleaseThread); \
EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers); \
EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \
EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate); \
Expand Down Expand Up @@ -433,6 +434,7 @@ EGL_IMPORT
m_context = NULL;
}

EGL_CHECK(eglReleaseThread() );
eglClose(m_eglLibrary);

# if BX_PLATFORM_RPI
Expand Down

0 comments on commit 85726bc

Please sign in to comment.