mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-05-01 06:48:01 +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);
|
mid = req->mid = XAllocID(dpy);
|
||||||
req->srcCmap = src_cmap;
|
req->srcCmap = src_cmap;
|
||||||
|
|
||||||
UnlockDisplay(dpy);
|
|
||||||
SyncHandle();
|
|
||||||
|
|
||||||
#if XCMS
|
#if XCMS
|
||||||
_XcmsCopyCmapRecAndFree(dpy, src_cmap, mid);
|
_XcmsCopyCmapRecAndFree(dpy, src_cmap, mid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
UnlockDisplay(dpy);
|
||||||
|
SyncHandle();
|
||||||
|
|
||||||
return(mid);
|
return(mid);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,12 @@ Colormap XCreateColormap(
|
||||||
if (visual == CopyFromParent) req->visual = CopyFromParent;
|
if (visual == CopyFromParent) req->visual = CopyFromParent;
|
||||||
else req->visual = visual->visualid;
|
else req->visual = visual->visualid;
|
||||||
|
|
||||||
UnlockDisplay(dpy);
|
|
||||||
SyncHandle();
|
|
||||||
|
|
||||||
#ifdef XCMS
|
#ifdef XCMS
|
||||||
_XcmsAddCmapRec(dpy, mid, w, visual);
|
_XcmsAddCmapRec(dpy, mid, w, visual);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
UnlockDisplay(dpy);
|
||||||
|
SyncHandle();
|
||||||
|
|
||||||
return(mid);
|
return(mid);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,12 @@ XFreeColormap(
|
||||||
LockDisplay(dpy);
|
LockDisplay(dpy);
|
||||||
GetResReq(FreeColormap, cmap, req);
|
GetResReq(FreeColormap, cmap, req);
|
||||||
|
|
||||||
UnlockDisplay(dpy);
|
|
||||||
SyncHandle();
|
|
||||||
|
|
||||||
#ifdef XCMS
|
#ifdef XCMS
|
||||||
_XcmsDeleteCmapRec(dpy, cmap);
|
_XcmsDeleteCmapRec(dpy, cmap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
UnlockDisplay(dpy);
|
||||||
|
SyncHandle();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue