Commit 99a2cf1a authored by Tapani Pälli's avatar Tapani Pälli

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: #94

v2: handle XCopyColormapAndFree also (Adam Jackson)
Signed-off-by: Tapani Pälli's avatarTapani Pälli <tapani.palli@intel.com>
parent fea80d03
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment