Merge pull request #2870 from Sonicadvance1/GLInterface_Fix
Fix a memory leak in the EGL GLInterface.
This commit is contained in:
commit
bdbe723d6e
|
@ -27,7 +27,6 @@ void cInterfaceEGL::DetectMode()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EGLint num_configs;
|
EGLint num_configs;
|
||||||
EGLConfig *config = nullptr;
|
|
||||||
bool supportsGL = false, supportsGLES2 = false, supportsGLES3 = false;
|
bool supportsGL = false, supportsGLES2 = false, supportsGLES3 = false;
|
||||||
std::array<int, 3> renderable_types = {
|
std::array<int, 3> renderable_types = {
|
||||||
EGL_OPENGL_BIT,
|
EGL_OPENGL_BIT,
|
||||||
|
@ -51,16 +50,17 @@ void cInterfaceEGL::DetectMode()
|
||||||
if (!eglChooseConfig( egl_dpy, attribs, nullptr, 0, &num_configs))
|
if (!eglChooseConfig( egl_dpy, attribs, nullptr, 0, &num_configs))
|
||||||
{
|
{
|
||||||
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
|
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
|
||||||
goto err_exit;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
config = new EGLConfig[num_configs];
|
EGLConfig* config = new EGLConfig[num_configs];
|
||||||
|
|
||||||
// Get all the configurations
|
// Get all the configurations
|
||||||
if (!eglChooseConfig(egl_dpy, attribs, config, num_configs, &num_configs))
|
if (!eglChooseConfig(egl_dpy, attribs, config, num_configs, &num_configs))
|
||||||
{
|
{
|
||||||
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
|
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
|
||||||
goto err_exit;
|
delete[] config;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < num_configs; ++i)
|
for (int i = 0; i < num_configs; ++i)
|
||||||
|
@ -78,6 +78,7 @@ void cInterfaceEGL::DetectMode()
|
||||||
supportsGLES2 = true;
|
supportsGLES2 = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete[] config;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supportsGL)
|
if (supportsGL)
|
||||||
|
@ -87,11 +88,8 @@ void cInterfaceEGL::DetectMode()
|
||||||
else if (supportsGLES2)
|
else if (supportsGLES2)
|
||||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGLES2;
|
s_opengl_mode = GLInterfaceMode::MODE_OPENGLES2;
|
||||||
|
|
||||||
err_exit:
|
|
||||||
if (s_opengl_mode == GLInterfaceMode::MODE_DETECT) // Errored before we found a mode
|
if (s_opengl_mode == GLInterfaceMode::MODE_DETECT) // Errored before we found a mode
|
||||||
s_opengl_mode = GLInterfaceMode::MODE_OPENGL; // Fall back to OpenGL
|
s_opengl_mode = GLInterfaceMode::MODE_OPENGL; // Fall back to OpenGL
|
||||||
if (config)
|
|
||||||
delete[] config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create rendering window.
|
// Create rendering window.
|
||||||
|
|
Loading…
Reference in New Issue