forked from organicmaps/organicmaps-tmp
[new downloader] Fix deferred deleting mwms
This commit is contained in:
parent
947d2f65f4
commit
ac1e65ca74
3 changed files with 11 additions and 2 deletions
|
@ -517,10 +517,15 @@ bool Framework::OnCountryFileDelete(storage::TCountryId const & countryId, stora
|
|||
|
||||
void Framework::OnMapDeregistered(platform::LocalCountryFile const & localFile)
|
||||
{
|
||||
GetPlatform().RunOnGuiThread([this, localFile]
|
||||
auto action = [this, localFile]
|
||||
{
|
||||
m_storage.DeleteCustomCountryVersion(localFile);
|
||||
});
|
||||
};
|
||||
|
||||
if (m_storage.GetThreadChecker().CalledOnOriginalThread())
|
||||
action();
|
||||
else
|
||||
GetPlatform().RunOnGuiThread(action);
|
||||
}
|
||||
|
||||
bool Framework::HasUnsavedEdits(storage::TCountryId const & countryId)
|
||||
|
|
|
@ -478,6 +478,8 @@ void Storage::DeleteCountry(TCountryId const & countryId, MapOptions opt)
|
|||
|
||||
void Storage::DeleteCustomCountryVersion(LocalCountryFile const & localFile)
|
||||
{
|
||||
ASSERT_THREAD_CHECKER(m_threadChecker, ());
|
||||
|
||||
CountryFile const countryFile = localFile.GetCountryFile();
|
||||
DeleteFromDiskWithIndexes(localFile, MapOptions::MapWithCarRouting);
|
||||
|
||||
|
|
|
@ -247,6 +247,8 @@ private:
|
|||
void DownloadNextFile(QueuedCountry const & country);
|
||||
|
||||
public:
|
||||
ThreadChecker const & GetThreadChecker() const {return m_threadChecker;}
|
||||
|
||||
/// \brief Storage will create its directories in Writable Directory
|
||||
/// (gotten with platform::WritableDir) by default.
|
||||
/// \param pathToCountriesFile is a name of countries.txt file.
|
||||
|
|
Loading…
Add table
Reference in a new issue