Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Pimenov <m@maps.me>2019-03-04 18:53:09 +0300
committerAleksandr Zatsepin <alexzatsepin@users.noreply.github.com>2019-03-13 12:57:30 +0300
commit21fc72fc0d940f7959a0a68ec8e834a7ae7b85ae (patch)
treed73ed089c99aae15b94106dcb38f81df81db756a /storage
parent42294122d9a5bb3cebc2679647878a0d9cd6a5ee (diff)
[storage] Fixed a crash.
Consider the following scenario. 1. Diffs for A and B are downloaded but not applied. Currently it is possible because we do not delete a diff whose application process was cancelled. 2. The update button is clicked for both A and B, adding them both to the queue. 3. The cancel button is clicked for both A and B. The cancellation of A sends a signal to the diff manager and kicks the downloader to start applying B. The diff manager receives the signal to cancel A and resets the m_latestDiffRequest. Then, the cancel request to B clears the queue but never reaches the diff manager (because of the m_latestDiffRequest mismatch), and, once the diff to B has been successfully applied, Storage cannot remove B from queue because it has already been removed.
Diffstat (limited to 'storage')
-rw-r--r--storage/storage.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/storage/storage.cpp b/storage/storage.cpp
index e41acf8798..b036a12092 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -700,6 +700,12 @@ void Storage::DownloadNextFile(QueuedCountry const & country)
// switch to next file.
if (isDownloadedDiff || p.GetFileSizeByFullPath(readyFilePath, size))
{
+ if (m_latestDiffRequest)
+ {
+ // No need to kick the downloader: it will be kicked by
+ // the current diff application process when it is completed or cancelled.
+ return;
+ }
OnMapFileDownloadFinished(HttpRequest::Status::Completed,
MapFilesDownloader::Progress(size, size));
return;
@@ -1600,14 +1606,18 @@ void Storage::ApplyDiff(CountryId const & countryId, function<void(bool isSucces
RegisterCountryFiles(diffFile);
Platform::DisableBackupForFile(diffFile->GetPath(MapOptions::Map));
fn(true);
+ break;
}
- break;
case DiffApplicationResult::Cancelled:
{
- CHECK(!IsDiffApplyingInProgressToCountry(countryId), ());
+ DownloadNextCountryFromQueue();
+ break;
+ }
+ case DiffApplicationResult::Failed:
+ {
+ fn(false);
+ break;
}
- break;
- case DiffApplicationResult::Failed: fn(false); break;
}
});
});