summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-02-03 23:05:10 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-02-03 23:05:10 +0100
commit2de5952b2b3ba641000ac916b18e92e8cdbccc8d (patch)
treef790ac9915f5f10f5b442e1e527023850b08a948
parent2cbd27c90677f3b914e49634b43a846b0d0ade56 (diff)
egl_dri2: Fix __DRIdrawable refcounting
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index e121353005..5cc6b0db52 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1868,11 +1868,12 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
(void) drv;
+ if (dri2_surf)
+ (*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable);
+
if (!_eglPutSurface(surf))
return EGL_TRUE;
- (*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable);
-
switch (disp->Platform) {
case _EGL_PLATFORM_X11:
xcb_dri2_destroy_drawable (dri2_dpy->conn, dri2_surf->drawable);
@@ -1934,8 +1935,11 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
if ((cctx == NULL && ddraw == NULL && rdraw == NULL) ||
dri2_dpy->core->bindContext(cctx, ddraw, rdraw)) {
+
dri2_destroy_surface(drv, disp, old_dsurf);
- dri2_destroy_surface(drv, disp, old_rsurf);
+ if (old_rsurf != old_dsurf)
+ dri2_destroy_surface(drv, disp, old_rsurf);
+
if (old_ctx) {
/* unbind the old context only when there is no new context bound */
if (!ctx) {