From d02ece7c63a1a189dbd3eaad310c30d7b7ac2cdf Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Tue, 2 Oct 2018 13:30:56 +0300 Subject: [PATCH] Fixed crash on edits uploading --- editor/osm_editor.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/editor/osm_editor.cpp b/editor/osm_editor.cpp index 47432e52ea..be1eb92d2a 100644 --- a/editor/osm_editor.cpp +++ b/editor/osm_editor.cpp @@ -843,10 +843,18 @@ void Editor::UploadChanges(string const & key, string const & secret, ChangesetT {"mwm_version", strings::to_string(fti.m_feature.GetID().GetMwmVersion())}}, alohalytics::Location::FromLatLon(ll.lat, ll.lon)); } - GetPlatform().RunTask(Platform::Thread::Gui, [this, id = fti.m_feature.GetID(), uploadInfo]() + + // TODO (@milchakov): We can't call RunTask on Platform::Thread::Gui from async(launch::async, ...), + // since the thread must be attached to JVM to post tasks on gui thread. + // Now here is a workaround to prevent crash, but we have to consider the possibility to get rid of + // async(launch::async, ...) here. + GetPlatform().RunTask(Platform::Thread::Network, [this, id = fti.m_feature.GetID(), uploadInfo]() { - // Call Save every time we modify each feature's information. - SaveUploadedInformation(id, uploadInfo); + GetPlatform().RunTask(Platform::Thread::Gui, [this, id, uploadInfo]() + { + // Call Save every time we modify each feature's information. + SaveUploadedInformation(id, uploadInfo); + }); }); } }