diff --git a/src/sync.h b/src/sync.h index 62f57365fd..f9bbdf6913 100644 --- a/src/sync.h +++ b/src/sync.h @@ -160,10 +160,11 @@ class SCOPED_LOCKABLE UniqueLock : public Base bool TryEnter(const char* pszName, const char* pszFile, int nLine) { EnterCritical(pszName, pszFile, nLine, (void*)(Base::mutex()), true); - Base::try_lock(); - if (!Base::owns_lock()) - LeaveCritical(); - return Base::owns_lock(); + if (Base::try_lock()) { + return true; + } + LeaveCritical(); + return false; } public: