[PATCH weston] gl-renderer: Fix an invalid write when closing a Weston window

Dima Ryazanov dima at gmail.com
Thu Nov 24 12:50:40 UTC 2016


Hi Daniel,

Forgot to mention: this only happens when using the wayland backend, not
x11. It's triggered by the next call to eglMakeCurrent (when the remaining
window is repainted), so it might not happen immediately, either. I'm using
an Intel graphics card and Mesa 12.0.3.

I actually saw the comment in gl_renderer_destroy and searched for Mesa
bugs, but found this email:
https://lists.freedesktop.org/archives/wayland-devel/2013-October/011622.html
"[...] An EGLSurface is current for a context from eglMakeCurrent up until
eglMakeCurrent is called for the conetxte with another surface or the
context is destroyed.  The wl_egl_surface (the native window object) has to
be available (can not be destroyed) for the entire time the EGLSurface
exists."
(Though it's from 2013, so maybe things have changed since.)

There was also a similar fix for the simple-egl client a while ago:
https://lists.freedesktop.org/archives/wayland-devel/2013-April/008718.html

On Thu, Nov 24, 2016 at 3:51 AM, Daniel Stone <daniel at fooishbar.org> wrote:

> Hi Dima,
>
> On 24 November 2016 at 02:41, Dima Ryazanov <dima at gmail.com> wrote:
> > Call eglMakeCurrent before destroying the native EGL window, similar to
> what
> > other sample clients are already doing.
>
> This doesn't show as an error here, with your suggested reproduction
> instructions. From eglDestroySurface:
> 'If the EGL surface surface is not current to any thread,
> eglDestroySurface destroys it immediately. Otherwise, surface is
> destroyed when it becomes not current to any thread.'
>
> Which GL stack are you using? The comment above the no-surface
> MakeCurrent in gl_renderer_destroy() is probably pretty telling, that
> Mesa once had a bug.
>
> Regardless of this, I am inclined to apply it to match the others,
> even just so we can be sure that the destroy takes effect immediately.
>
> Cheers,
> Daniel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20161124/e9ebc375/attachment-0001.html>


More information about the wayland-devel mailing list