sharplispers / clx

a fork of crhodes' fork of danb's fork of the CLX library, an X11 client for Common Lisp
Other
114 stars 46 forks source link

Perform all resource id hash-table accesses under the display lock #149

Closed scymtym closed 4 years ago

scymtym commented 4 years ago

Before this change, the functions generated by generate-lookup-functions, and lookup-window in particular, could end up accessing the resource id hash-table without holding the display lock: If the initial lookup-resource-id call (protected by the display lock) returned nil, a fresh id was generated and stored by calling save-id. However, the display lock was release before calling save-id.

Since most implementations don't allow concurrent modification of hash-tables without special precautions, the locking bug described above could and did lead to actual failures. In fact, it was only noticed because SBCL detected an invariant violation after a hash-table had been corrupted due to this bug (See attached screenshot).

screenshot