Commit Graph
1 Commits
Author SHA1 Message Date
Nic BoetandClaude Opus 5.5 4eca3d7ee4 fix: don't let a failed ZMPacket::trylock overwrite the lock flag
ZMPacket::trylock() stored the result of try_lock() in the shared
`locked` member and returned that member. A failed attempt wrote false
while another thread held the mutex, and the thread that had just
taken the lock could return the other thread's false. ThreadSanitizer
reports the write (zm_packet.cpp:397) against unlock() (:404).

Return the local result and set `locked` only on success. The member is
read in Debug lines without the mutex, so make it std::atomic<bool>.

fixes #5248

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 11:45:37 -05:00