[Mesa-dev] [PATCH] egl/wayland-egl: Fix for segfault in dri2_wl_destroy_surface.

Emil Velikov emil.l.velikov at gmail.com
Wed Aug 24 09:23:11 UTC 2016


On 24 August 2016 at 08:48, Stencel, Joanna <joanna.stencel at intel.com> wrote:
> I couldn't find any clear requirement about order of destroys in EGL (or wayland) specification.
> Also, in EGL spec (3.7.3, about eglMakeCurrent) one can find:
>
> " If a native window underlying either draw or read is no longer valid, an
> EGL_BAD_NATIVE_WINDOW error is generated."
> "If a native window or pixmap underlying the draw or read surfaces is
> destroyed, rendering and readback are handled as above."
>
> So it seems that in general destroying native window underlying existing surface can be a case
> and should be handled.
> I agree that it's reasonable to call eglDestroySurface() first and probably most people do this.
> However, I think that different user's usage shouldn't cause a crash (or memory issues).
>
Completely agree - crashing (esp in the driver) isn't what we want.
Seems like we don't handle the case you mentioned. Care to spin a
patch ?

> Could you explain what you call a memory leak here? Pointer which is nullified points to already
> free'd structure of wayland window.
>
Hmm you're right - it's the EGL implementation's back pointer that
gets nullified and not the original one used by the wayland-egl (as I
originally thought).

With that said, I've rebased the patch on top of master added the tags
and pushed to master.

Thanks for the contribution !
Emil


More information about the mesa-dev mailing list