Race condition in the remote size loading logic

The quota retrieval process might not be finished by the time
the used space on the server (`_rSize`) is compared against
the locally available disk space which might end up in
a "There isn't enough free space in the local folder!" message
even if there is enough free space.

This patch updates the status after the quota has been retrieved.

It also initializes `_rSize` to `-1` so that errors like this
are easier to catch in the future.
This commit is contained in:
Ivan Čukić 2019-05-08 22:54:52 +02:00
parent 8151eb4837
commit 0f7c10a2d6

View file

@ -42,6 +42,8 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage()
, _localFolderValid(false) , _localFolderValid(false)
, _progressIndi(new QProgressIndicator(this)) , _progressIndi(new QProgressIndicator(this))
, _remoteFolder() , _remoteFolder()
, _rSize(-1)
, _rSelectedSize(-1)
{ {
_ui.setupUi(this); _ui.setupUi(this);
@ -368,6 +370,8 @@ void OwncloudAdvancedSetupPage::slotQuotaRetrieved(const QVariantMap &result)
{ {
_rSize = result["size"].toDouble(); _rSize = result["size"].toDouble();
_ui.lSyncEverythingSizeLabel->setText(tr("(%1)").arg(Utility::octetsToString(_rSize))); _ui.lSyncEverythingSizeLabel->setText(tr("(%1)").arg(Utility::octetsToString(_rSize)));
updateStatus();
} }
qint64 OwncloudAdvancedSetupPage::availableLocalSpace() const qint64 OwncloudAdvancedSetupPage::availableLocalSpace() const