winsys: wayland: destroy eglsurface when destroying associated native window

On Wayland deinit() of an onscreen buffer is going to destroy the
associated native window of an EGLSurface. So we should destroy the
EGLSurface as well otherwise we might end up confusing the GL driver.

We also currently guard against setting a EGL_NO_SURFACE as current
EGLSurface, but this shouldn't be a problem if we have a surfaceless
context. So we allow surface destruction under that condition.

https://bugzilla.gnome.org/show_bug.cgi?id=754667
This commit is contained in:
Lionel Landwerlin 2015-09-07 02:26:16 +01:00
parent 6bd49c3dc8
commit 4cb750928e

View File

@ -676,7 +676,9 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
/* Cogl always needs a valid context bound to something so if we /* Cogl always needs a valid context bound to something so if we
* are destroying the onscreen that is currently bound we'll * are destroying the onscreen that is currently bound we'll
* switch back to the dummy drawable. */ * switch back to the dummy drawable. */
if (egl_display->dummy_surface != EGL_NO_SURFACE && if ((egl_display->dummy_surface != EGL_NO_SURFACE ||
(egl_renderer->private_features &
COGL_EGL_WINSYS_FEATURE_SURFACELESS_CONTEXT) != 0) &&
(egl_display->current_draw_surface == egl_onscreen->egl_surface || (egl_display->current_draw_surface == egl_onscreen->egl_surface ||
egl_display->current_read_surface == egl_onscreen->egl_surface)) egl_display->current_read_surface == egl_onscreen->egl_surface))
{ {