Close `g_egl_gl_dll` if `egl_init_context()` fails

This commit is contained in:
刘皓 2025-08-02 09:58:40 -04:00
parent 2b23e16790
commit 38861b31bf
No known key found for this signature in database
GPG Key ID: 7901753DB465B711
1 changed files with 30 additions and 2 deletions

View File

@ -630,18 +630,46 @@ bool egl_init_context(egl_ctx_data_t *egl,
if (dpy == EGL_NO_DISPLAY)
{
RARCH_ERR("[EGL] Couldn't get EGL display.\n");
#ifdef HAVE_DYLIB
if (g_egl_gl_dll)
{
dylib_close(g_egl_gl_dll);
g_egl_gl_dll = NULL;
}
#endif
return false;
}
egl->dpy = dpy;
if (!egl_initialize(egl->dpy, major, minor))
{
#ifdef HAVE_DYLIB
if (g_egl_gl_dll)
{
dylib_close(g_egl_gl_dll);
g_egl_gl_dll = NULL;
}
#endif
return false;
}
RARCH_LOG("[EGL] EGL version: %d.%d.\n", *major, *minor);
return egl_init_context_common(egl, count, attrib_ptr, cb,
display_data);
if (egl_init_context_common(egl, count, attrib_ptr, cb,
display_data))
return true;
else
{
#ifdef HAVE_DYLIB
if (g_egl_gl_dll)
{
dylib_close(g_egl_gl_dll);
g_egl_gl_dll = NULL;
}
#endif
return false;
}
}
bool egl_create_context(egl_ctx_data_t *egl, const EGLint *egl_attribs)