egl: don't destroy wayland egl context

The egl context is from Gtk on Wayland. Destroy it only on X11.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
Marc-André Lureau 2016-05-20 15:36:09 +02:00
parent f853ab3e6e
commit cb92524414

View File

@ -364,10 +364,6 @@ void spice_egl_unrealize_display(SpiceDisplay *display)
d->egl.tex_pointer_id = 0;
}
if (d->egl.surface != EGL_NO_SURFACE) {
eglDestroySurface(d->egl.display, d->egl.surface);
d->egl.surface = EGL_NO_SURFACE;
}
if (d->egl.vbuf_id) {
glDeleteBuffers(1, &d->egl.vbuf_id);
d->egl.vbuf_id = 0;
@ -378,14 +374,24 @@ void spice_egl_unrealize_display(SpiceDisplay *display)
d->egl.prog = 0;
}
if (d->egl.ctx) {
eglDestroyContext(d->egl.display, d->egl.ctx);
d->egl.ctx = 0;
}
if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
/* egl.surface && egl.ctx are only created on x11, see
spice_egl_init() */
eglMakeCurrent(d->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
eglTerminate(d->egl.display);
if (d->egl.surface != EGL_NO_SURFACE) {
eglDestroySurface(d->egl.display, d->egl.surface);
d->egl.surface = EGL_NO_SURFACE;
}
if (d->egl.ctx) {
eglDestroyContext(d->egl.display, d->egl.ctx);
d->egl.ctx = 0;
}
eglMakeCurrent(d->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
eglTerminate(d->egl.display);
}
}
G_GNUC_INTERNAL