log: fix Unhandled Exception on windows 7 (#24803)

This commit is contained in:
xieke 2025-06-28 13:18:58 +08:00 committed by GitHub
parent ce33cc490f
commit 81e84a6a01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,8 +24,9 @@ pub fn new_thread_safe_log() &ThreadSafeLog {
pub fn (mut x ThreadSafeLog) free() {
unsafe {
// make sure other threads are not in the blocks protected by the mutex:
x.mu.try_lock()
if x.mu.try_lock() {
x.mu.unlock()
}
x.mu.destroy()
free(x.mu)
x.mu = nil