Skip to content

Make colormap private interfaces thread safe

Olivier Fourdan requested to merge ofourdan/libx11:fix-issue-215 into master

To fix issue #94 (closed), the _Xcms*CmapRec*() family of functions were moved within the display lock as part of !12 (merged).

Unfortunately, that causes a deadlock in XCopyColormapAndFree(), because _XcmsCopyCmapRecAndFree() calls CmapRecForColormap() which calls XGetVisualInfo() which also tries to acquire the display lock.

So, instead of moving the entire functions within the display lock, let's try to make the functions themselves thread safe in the following commit.

That means reverting !12 (merged) and !31 (merged) and make the _Xcms*CmapRec*() family of functions thread safe instead.

I am also attaching the reproducer for #94 (closed) (with more threads and iterations) and a variant that uses XCopyColormapAndFree() to make sure sure they work with multiple threads. Both seem to work fine here with this branch.

And also does the XTS test XCopyColormapAndFree/5.

Closes: #215 (closed)
See-also: #94 (closed)

/cc @ajax @tpalli @aplattner

Edited by Olivier Fourdan

Merge request reports

Loading