diff --git a/src/Magnum/Platform/WindowlessEglApplication.cpp b/src/Magnum/Platform/WindowlessEglApplication.cpp index 1d156633f..27c3f6442 100644 --- a/src/Magnum/Platform/WindowlessEglApplication.cpp +++ b/src/Magnum/Platform/WindowlessEglApplication.cpp @@ -83,6 +83,8 @@ bool extensionSupported(const char* const extensions, Containers::ArrayView + * and will return the same EGLDisplay handle.` This makes a problem when + * the context is shared with another one, because both shares the same EGLDisplay. + * To avoid errors when trying to make current the other context (EGL_NOT_INITIALIZED) + * we don't terminate the shared display. + * It is then the user's responsaibility to first kill the shared EGL instance + * (which won't terminate the display), and then main one, killing everything. + */ + if(_sharedContext && _display) eglTerminate(_display); } WindowlessEglContext& WindowlessEglContext::operator=(WindowlessEglContext && other) { diff --git a/src/Magnum/Platform/WindowlessEglApplication.h b/src/Magnum/Platform/WindowlessEglApplication.h index bc023f85b..f7566d452 100644 --- a/src/Magnum/Platform/WindowlessEglApplication.h +++ b/src/Magnum/Platform/WindowlessEglApplication.h @@ -132,6 +132,9 @@ class WindowlessEglContext { EGLContext glContext() { return _context; } private: + /* Stores whether the EGL context is shared or not */ + bool _sharedContext = false; + EGLDisplay _display{}; EGLContext _context{}; #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)