Browse Source

WorkerThreadPool: Fix wrong pointer used in the case of BinaryMutex

Pedro J. Estébanez 1 year ago
parent
commit
f2f9a6b8a1
1 changed files with 2 additions and 2 deletions
  1. 2 2
      core/object/worker_thread_pool.cpp

+ 2 - 2
core/object/worker_thread_pool.cpp

@@ -427,7 +427,7 @@ void WorkerThreadPool::_lock_unlockable_mutexes() {
 			if ((((uintptr_t)unlockable_mutexes[i]) & 1) == 0) {
 			if ((((uintptr_t)unlockable_mutexes[i]) & 1) == 0) {
 				((Mutex *)unlockable_mutexes[i])->lock();
 				((Mutex *)unlockable_mutexes[i])->lock();
 			} else {
 			} else {
-				((BinaryMutex *)unlockable_mutexes[i])->lock();
+				((BinaryMutex *)(unlockable_mutexes[i] & ~1))->lock();
 			}
 			}
 		}
 		}
 	}
 	}
@@ -441,7 +441,7 @@ void WorkerThreadPool::_unlock_unlockable_mutexes() {
 			if ((((uintptr_t)unlockable_mutexes[i]) & 1) == 0) {
 			if ((((uintptr_t)unlockable_mutexes[i]) & 1) == 0) {
 				((Mutex *)unlockable_mutexes[i])->unlock();
 				((Mutex *)unlockable_mutexes[i])->unlock();
 			} else {
 			} else {
-				((BinaryMutex *)unlockable_mutexes[i])->unlock();
+				((BinaryMutex *)(unlockable_mutexes[i] & ~1))->unlock();
 			}
 			}
 		}
 		}
 	}
 	}