------- GetColor.c ------- --- /tmp/geta26517 Sat Jun 18 18:56:39 2005 +++ /tmp/getb26517 Sat Jun 18 18:56:39 2005 @@ -61,18 +61,21 @@ /* * Let's Attempt to use Xcms and i18n approach to Parse Color */ /* copy string to allow overwrite by _XcmsResolveColorString() */ if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { + LockDisplay(dpy); if (_XcmsResolveColorString(ccc, &colorname, &cmsColor_exact, XcmsRGBFormat) >= XcmsSuccess) { _XcmsRGB_to_XColor(&cmsColor_exact, exact_def, 1); memcpy((char *)hard_def, (char *)exact_def, sizeof(XColor)); + UnlockDisplay(dpy); ret = XAllocColor(dpy, cmap, hard_def); exact_def->pixel = hard_def->pixel; return(ret); } + UnlockDisplay(dpy); /* * Otherwise we failed; or colorname was changed with yet another * name. Thus pass name to the X Server. */ } ------- LookupCol.c ------- --- /tmp/geta26517 Sat Jun 18 18:56:39 2005 +++ /tmp/getb26517 Sat Jun 18 18:56:39 2005 @@ -58,17 +58,20 @@ /* * Let's Attempt to use Xcms and i18n approach to Parse Color */ /* copy string to allow overwrite by _XcmsResolveColorString() */ if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { + LockDisplay(dpy); if (_XcmsResolveColorString(ccc, &spec, &cmsColor_exact, XcmsRGBFormat) >= XcmsSuccess) { _XcmsRGB_to_XColor(&cmsColor_exact, def, 1); memcpy((char *)scr, (char *)def, sizeof(XColor)); _XUnresolveColor(ccc, scr); + UnlockDisplay(dpy); return(1); } + UnlockDisplay(dpy); /* * Otherwise we failed; or spec was changed with yet another * name. Thus pass name to the X Server. */ } @@ -76,13 +79,12 @@ /* * Xcms and i18n methods failed, so lets pass it to the server * for parsing. */ - + LockDisplay(dpy); n = strlen (spec); - LockDisplay(dpy); GetReq (LookupColor, req); req->cmap = cmap; req->nbytes = n; req->length += (n + 3) >> 2; Data (dpy, spec, (long)n);