On Mon, Apr 22, 2013 at 12:48:43PM +0300, Pekka Paalanen wrote:
> On Fri, 19 Apr 2013 17:49:12 +0000
> "Yeh, Sinclair" <sinclair....@intel.com> wrote:
> 
> > wl_egl_window_destory() distroys the window handle that
> > dri2_destroy_surface() later uses when eglTerminate() is called.
> > 
> > Reordering the tear down order prevents such case from occuring.
> > ---
> >  clients/simple-egl.c |   11 ++++++-----
> >  1 files changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/clients/simple-egl.c b/clients/simple-egl.c index
> > 26ebe5c..f4468b7 100644 --- a/clients/simple-egl.c
> > +++ b/clients/simple-egl.c
> > @@ -146,11 +146,6 @@ init_egl(struct display *display, int opaque)
> > static void  fini_egl(struct display *display)  {
> > -   /* Required, otherwise segfault in egl_dri2.c:
> > dri2_make_current()
> > -    * on eglReleaseThread(). */
> > -   eglMakeCurrent(display->egl.dpy, EGL_NO_SURFACE,
> > EGL_NO_SURFACE,
> > -                  EGL_NO_CONTEXT);
> > -
> >     eglTerminate(display->egl.dpy);
> >     eglReleaseThread();
> >  }
> > @@ -330,6 +325,12 @@ create_surface(struct window *window)  static
> > void  destroy_surface(struct window *window)  {
> > +   /* Required, otherwise segfault in egl_dri2.c:
> > dri2_make_current()
> > +    * on eglReleaseThread(). */
> > +   eglMakeCurrent(window->display->egl.dpy, EGL_NO_SURFACE,
> > EGL_NO_SURFACE,
> > +                  EGL_NO_CONTEXT);
> > +
> > +   eglDestroySurface(window->display->egl.dpy,
> > window->egl_surface); wl_egl_window_destroy(window->native);
> >  
> >     wl_shell_surface_destroy(window->shell_surface);
> 
> Wow, now that you actually point this out, it's pretty obvious. Though,
> are you sure there is no Mesa bug to be fixed here?

I looked at the MESA code, and while I think something should be done to
detect the case when the handle has already been freed, I didn't have a
chance to dig deeper.  When I do, I'll submit a separate patch to MESA.

> 
> The patch looks good to me.

Can you do a "Reviewed-by" to make it formal?  In case Kristian needs
that to do a commit.

Signed-off-by:  Sinclair Yeh <sinclair....@intel.com>

thanks for reviewing,

Sinclair

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to