mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-04-03 11:30:42 +02:00
Protect colormap add/removal with display lock
This fixes a bug where concurrent threads call XCreateColormap and XFreeColormap corrupting a linked list where colormap structures are stored. Fixes: https://gitlab.freedesktop.org/xorg/lib/libx11/issues/94 v2: handle XCopyColormapAndFree also (Adam Jackson) Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
This commit is contained in:
parent
fea80d03c3
commit
99a2cf1aa0
3 changed files with 9 additions and 9 deletions
|
|
@ -53,12 +53,12 @@ Colormap XCopyColormapAndFree(
|
|||
mid = req->mid = XAllocID(dpy);
|
||||
req->srcCmap = src_cmap;
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
#if XCMS
|
||||
_XcmsCopyCmapRecAndFree(dpy, src_cmap, mid);
|
||||
#endif
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return(mid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ Colormap XCreateColormap(
|
|||
if (visual == CopyFromParent) req->visual = CopyFromParent;
|
||||
else req->visual = visual->visualid;
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
#ifdef XCMS
|
||||
_XcmsAddCmapRec(dpy, mid, w, visual);
|
||||
#endif
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return(mid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ XFreeColormap(
|
|||
LockDisplay(dpy);
|
||||
GetResReq(FreeColormap, cmap, req);
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
#ifdef XCMS
|
||||
_XcmsDeleteCmapRec(dpy, cmap);
|
||||
#endif
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue