Browse Source

Platform: *really* destroy EGL context in WindowlessEglApp destructor.

pull/461/head
erikwijmans 6 years ago committed by Vladimír Vondruš
parent
commit
68aec7b088
  1. 7
      doc/changelog.dox
  2. 14
      src/Magnum/Platform/WindowlessEglApplication.cpp

7
doc/changelog.dox

@ -87,6 +87,13 @@ See also:
- Fixed compilation of the @ref GL library on macOS with ANGLE --- new code
assumed macOS is always desktop GL (see [mosra/magnum#452](https://github.com/mosra/magnum/issues/452))
@subsection changelog-latest-bugfixes Bug fixes
- Creating @ref Platform::WindowlessEglApplication again after it was
destroyed could fail with an error saying "cannot make the previous context
current" on certain system. This was due to EGL not destroying the context
if it's still made current.
@subsection changelog-latest-compatibility Potential compatibility breakages, removed APIs
- Removed remaining APIs deprecated in version 2018.10, in particular:

14
src/Magnum/Platform/WindowlessEglApplication.cpp

@ -442,7 +442,19 @@ WindowlessEglContext::WindowlessEglContext(WindowlessEglContext&& other):
}
WindowlessEglContext::~WindowlessEglContext() {
if(_context) eglDestroyContext(_display, _context);
if(_context) {
/* eglDestroyContext() doesn't actually destroy the context if it's
still current, it's only destroyed once eglMakeCurrent() makes some
other context current. This causes the "cannot make the previous
context current" error from above to appear if one creates an EGL
context again for a second time --- we switch from the (now zombie)
context to a new one to read the vendor string for the
"no-forward-compatible-core-context" workaround, at which point the
zombie gets finally killed, which then means we can't
eglMakeCurrent() it back after. */
eglMakeCurrent(_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroyContext(_display, _context);
}
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
if(_surface) eglDestroySurface(_display, _surface);
#endif

Loading…
Cancel
Save