From d03dc06cc92e3d1375c3f22a5e063841573bd951 Mon Sep 17 00:00:00 2001 From: Aaron Colwell <300262+acolwell@users.noreply.github.com> Date: Tue, 12 Mar 2024 05:35:49 -0700 Subject: [PATCH] Fix more QMutexLocker usage. (#952) Fixes more instances of unnamed QMutexLocker objects that were not holding the lock for the duration of the containing scope. --- Gui/ViewerGL.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Gui/ViewerGL.cpp b/Gui/ViewerGL.cpp index 70ceaba3c..b8aaf3f12 100644 --- a/Gui/ViewerGL.cpp +++ b/Gui/ViewerGL.cpp @@ -203,7 +203,7 @@ ViewerGL::resizeGL(int w, bool zoomSinceLastFit; double oldWidth, oldHeight; { - QMutexLocker(&_imp->zoomCtxMutex); + QMutexLocker l(&_imp->zoomCtxMutex); oldWidth = _imp->zoomCtx.screenWidth(); oldHeight = _imp->zoomCtx.screenHeight(); _imp->zoomCtx.setScreenSize(zoomWidth, zoomHeight, /*alignTop=*/ true, /*alignRight=*/ false); @@ -2911,7 +2911,7 @@ ViewerGL::fitImageToFormat() double zoomFactor; unsigned int oldMipmapLevel, newMipmapLevel; { - QMutexLocker(&_imp->zoomCtxMutex); + QMutexLocker l(&_imp->zoomCtxMutex); old_zoomFactor = _imp->zoomCtx.factor(); //oldMipmapLevel = std::log( old_zoomFactor >= 1 ? 1 : // std::pow( 2, -std::ceil(std::log(old_zoomFactor) / M_LN2) ) ) / M_LN2; @@ -3467,7 +3467,7 @@ ViewerGL::setUserRoIEnabled(bool b) // always running in the main thread assert( qApp && qApp->thread() == QThread::currentThread() ); { - QMutexLocker(&_imp->userRoIMutex); + QMutexLocker l(&_imp->userRoIMutex); _imp->userRoIEnabled = b; } if (!b) { @@ -3568,7 +3568,7 @@ bool ViewerGL::isUserRegionOfInterestEnabled() const { // MT-SAFE - QMutexLocker(&_imp->userRoIMutex); + QMutexLocker l(&_imp->userRoIMutex); return _imp->userRoIEnabled; } @@ -3577,7 +3577,7 @@ RectD ViewerGL::getUserRegionOfInterest() const { // MT-SAFE - QMutexLocker(&_imp->userRoIMutex); + QMutexLocker l(&_imp->userRoIMutex); return _imp->userRoI; } @@ -3586,7 +3586,7 @@ void ViewerGL::setUserRoI(const RectD & r) { // MT-SAFE - QMutexLocker(&_imp->userRoIMutex); + QMutexLocker l(&_imp->userRoIMutex); _imp->userRoI = r; }