Fix DatabaseTabWidget::lockDatabases returns false even when all tabs are locked

This commit is contained in:
Aetf 2020-05-24 15:16:57 -04:00 committed by Jonathan White
parent 443614a375
commit 1fbddf4149

View File

@ -627,7 +627,8 @@ DatabaseWidget* DatabaseTabWidget::currentDatabaseWidget()
bool DatabaseTabWidget::lockDatabases() bool DatabaseTabWidget::lockDatabases()
{ {
int numLocked = 0; 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); auto dbWidget = databaseWidgetFromIndex(i);
if (dbWidget->lock()) { if (dbWidget->lock()) {
++numLocked; ++numLocked;
@ -638,7 +639,7 @@ bool DatabaseTabWidget::lockDatabases()
} }
} }
return numLocked == count(); return numLocked == c;
} }
/** /**