[new downloader] Fix deferred deleting mwms

This commit is contained in:
Sergey Yershov 2016-03-25 14:06:08 +03:00
parent 947d2f65f4
commit ac1e65ca74
3 changed files with 11 additions and 2 deletions

View file

@ -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)

View file

@ -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);

View file

@ -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.