summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2006-10-10 23:03:28 -0700
committerJamey Sharp <jamey@minilop.net>2006-10-10 23:03:28 -0700
commit1eedf1bd033e496843cfde42ae4ae5a119298605 (patch)
tree022881b2cdacef63f6188a99fc0c2c2d85066936
parente17c2cbe9fbaa1600d4b9463ec800a874b0d87cd (diff)
Add correct Display locking to XKB functions.
Some XKB functions didn't correctly call LockDisplay or UnlockDisplay. This patch fixes at least some instances of that problem. Thanks to Magnus Kessler <Magnus.Kessler@gmx.net> for finding these bugs and proposing a fix, which this patch is based on.
-rw-r--r--src/xkb/XKBGeom.c28
-rw-r--r--src/xkb/XKBSetGeom.c1
-rw-r--r--src/xkb/XKBleds.c2
3 files changed, 23 insertions, 8 deletions
diff --git a/src/xkb/XKBGeom.c b/src/xkb/XKBGeom.c
index 02b03ba..fa652b2 100644
--- a/src/xkb/XKBGeom.c
+++ b/src/xkb/XKBGeom.c
@@ -632,21 +632,27 @@ XkbGetGeometry(Display *dpy,XkbDescPtr xkb)
{
xkbGetGeometryReq *req;
xkbGetGeometryReply rep;
+Status status;
if ( (!xkb) || (dpy->flags & XlibDisplayNoXkb) ||
(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
return BadAccess;
+ LockDisplay(dpy);
GetReq(kbGetGeometry, req);
req->reqType = dpy->xkb_info->codes->major_opcode;
req->xkbReqType = X_kbGetGeometry;
req->deviceSpec = xkb->device_spec;
req->name= None;
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse))
- return BadImplementation;
- if (!rep.found)
- return BadName;
- return _XkbReadGetGeometryReply(dpy,&rep,xkb,NULL);
+ status = BadImplementation;
+ else if (!rep.found)
+ status = BadName;
+ else
+ status = _XkbReadGetGeometryReply(dpy,&rep,xkb,NULL);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return status;
}
Status
@@ -654,20 +660,26 @@ XkbGetNamedGeometry(Display *dpy,XkbDescPtr xkb,Atom name)
{
xkbGetGeometryReq *req;
xkbGetGeometryReply rep;
+Status status;
if ( (name==None) || (dpy->flags & XlibDisplayNoXkb) ||
(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)) )
return BadAccess;
+ LockDisplay(dpy);
GetReq(kbGetGeometry, req);
req->reqType = dpy->xkb_info->codes->major_opcode;
req->xkbReqType = X_kbGetGeometry;
req->deviceSpec = xkb->device_spec;
req->name= (CARD32)name;
if ((!_XReply(dpy, (xReply *)&rep, 0, xFalse))||(!rep.found))
- return BadImplementation;
- if (!rep.found)
- return BadName;
- return _XkbReadGetGeometryReply(dpy,&rep,xkb,NULL);
+ status = BadImplementation;
+ else if (!rep.found)
+ status = BadName;
+ else
+ status = _XkbReadGetGeometryReply(dpy,&rep,xkb,NULL);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return status;
}
diff --git a/src/xkb/XKBSetGeom.c b/src/xkb/XKBSetGeom.c
index e070623..8e4d8b1 100644
--- a/src/xkb/XKBSetGeom.c
+++ b/src/xkb/XKBSetGeom.c
@@ -446,6 +446,7 @@ Status ret;
(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
return BadAccess;
+ LockDisplay(dpy);
GetReq(kbSetGeometry, req);
req->reqType = dpy->xkb_info->codes->major_opcode;
req->xkbReqType = X_kbSetGeometry;
diff --git a/src/xkb/XKBleds.c b/src/xkb/XKBleds.c
index 89ab2e9..865342c 100644
--- a/src/xkb/XKBleds.c
+++ b/src/xkb/XKBleds.c
@@ -228,6 +228,8 @@ XkbGetNamedDeviceIndicator( Display * dpy,
SyncHandle();
return False;
}
+ UnlockDisplay(dpy);
+ SyncHandle();
if ((!rep.found)||(!rep.supported))
return False;
if (pNdxRtrn!=NULL)