From 1fbddf41491a8ed40c2417e743e56705ec2cfc52 Mon Sep 17 00:00:00 2001 From: Aetf Date: Sun, 24 May 2020 15:16:57 -0400 Subject: [PATCH] Fix DatabaseTabWidget::lockDatabases returns false even when all tabs are locked --- src/gui/DatabaseTabWidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp index 2a873dbb2..49bfc4580 100644 --- a/src/gui/DatabaseTabWidget.cpp +++ b/src/gui/DatabaseTabWidget.cpp @@ -627,7 +627,8 @@ DatabaseWidget* DatabaseTabWidget::currentDatabaseWidget() bool DatabaseTabWidget::lockDatabases() { int numLocked = 0; - for (int i = 0, c = count(); i < c; ++i) { + int c = count(); + for (int i = 0; i < c; ++i) { auto dbWidget = databaseWidgetFromIndex(i); if (dbWidget->lock()) { ++numLocked; @@ -638,7 +639,7 @@ bool DatabaseTabWidget::lockDatabases() } } - return numLocked == count(); + return numLocked == c; } /**