egl_dri2: Do not destroy linked resources.
authorChia-I Wu <olvaffe@gmail.com>
Fri, 5 Feb 2010 03:27:55 +0000 (11:27 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Fri, 5 Feb 2010 03:45:01 +0000 (11:45 +0800)
A linked resource is stil owned by the display.

src/egl/drivers/dri2/egl_dri2.c

index 84dd958490e8516fa839181bbad0da9c19c6dddb..3bdac2944cb044e2c8fc5ed87175f379e4c91c75 100644 (file)
@@ -735,11 +735,11 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
 
    if ((cctx == NULL && ddraw == NULL && rdraw == NULL) ||
        dri2_dpy->core->bindContext(cctx, ddraw, rdraw)) {
-      if (dsurf)
+      if (dsurf && !_eglIsSurfaceLinked(dsurf))
         dri2_destroy_surface(drv, disp, dsurf);
-      if (rsurf && rsurf != dsurf)
+      if (rsurf && rsurf != dsurf && !_eglIsSurfaceLinked(dsurf))
         dri2_destroy_surface(drv, disp, rsurf);
-      if (ctx != NULL)
+      if (ctx != NULL && !_eglIsContextLinked(ctx))
         dri2_dpy->core->unbindContext(dri2_egl_context(ctx)->dri_context);
 
       return EGL_TRUE;