diff options
author | Kristian Høgsberg <[email protected]> | 2007-01-07 08:12:01 -0500 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2007-10-05 00:09:32 -0400 |
commit | 4a22ae8d446855d839cc199df8eb1b057045cb88 (patch) | |
tree | 727c7f597f768631106447be6f484abe6a5c4e50 /src/glx/x11/XF86dri.c | |
parent | 4ceefccbfa180d19e27716bf7f282d0438ac34bd (diff) |
Remove XIDs from DRI interface (see #5714).
Diffstat (limited to 'src/glx/x11/XF86dri.c')
-rw-r--r-- | src/glx/x11/XF86dri.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/glx/x11/XF86dri.c b/src/glx/x11/XF86dri.c index 8909a047721..721bb3e65ac 100644 --- a/src/glx/x11/XF86dri.c +++ b/src/glx/x11/XF86dri.c @@ -427,16 +427,37 @@ PUBLIC GLboolean XF86DRICreateDrawable( __DRInativeDisplay * ndpy, int screen, return True; } +static int noopErrorHandler(Display *dpy, XErrorEvent *xerr) +{ + return 0; +} + PUBLIC GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen, __DRIid drawable ) { Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); xXF86DRIDestroyDrawableReq *req; + int (*oldXErrorHandler)(Display *, XErrorEvent *); TRACE("DestroyDrawable..."); XF86DRICheckExtension (dpy, info, False); + /* This is called from the DRI driver, which used call it like this + * + * if (windowExists(drawable)) + * destroyDrawable(drawable); + * + * which is a textbook race condition - the window may disappear + * from the server between checking for its existance and + * destroying it. Instead we change the semantics of + * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if + * the windows is gone, by wrapping the destroy call in an error + * handler. */ + + XSync(dpy, GL_FALSE); + oldXErrorHandler = XSetErrorHandler(noopErrorHandler); + LockDisplay(dpy); GetReq(XF86DRIDestroyDrawable, req); req->reqType = info->codes->major_opcode; @@ -445,6 +466,9 @@ PUBLIC GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen, req->drawable = drawable; UnlockDisplay(dpy); SyncHandle(); + + XSetErrorHandler(oldXErrorHandler); + TRACE("DestroyDrawable... return True"); return True; } |