aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud
diff options
context:
space:
mode:
Diffstat (limited to 'backends/cloud')
-rw-r--r--backends/cloud/cloudmanager.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/backends/cloud/cloudmanager.cpp b/backends/cloud/cloudmanager.cpp
index 8b7230fb5c..ed48ec5079 100644
--- a/backends/cloud/cloudmanager.cpp
+++ b/backends/cloud/cloudmanager.cpp
@@ -128,7 +128,14 @@ void CloudManager::replaceStorage(Storage *storage, uint32 index) {
freeStorages();
if (!storage) error("CloudManager::replaceStorage: NULL storage passed");
if (index >= kStorageTotal) error("CloudManager::replaceStorage: invalid index passed");
- delete _activeStorage;
+ if (_activeStorage != nullptr && _activeStorage->isWorking()) {
+ warning("CloudManager::replaceStorage: replacing Storage while the other is working");
+ if (_activeStorage->isDownloading()) _activeStorage->cancelDownload();
+ if (_activeStorage->isSyncing()) _activeStorage->cancelSync();
+ removeStorage(_activeStorage);
+ } else {
+ delete _activeStorage;
+ }
_activeStorage = storage;
_currentStorageIndex = index;
save();