diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index c472e62698..2437c96595 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -400,8 +400,10 @@ void QSemaphore::release(int n) return; } - const auto locker = qt_scoped_lock(d->mutex); - d->avail += n; + { + const auto locker = qt_scoped_lock(d->mutex); + d->avail += n; + } d->cond.notify_all(); }