From 06a0e70e3892daf184290da033b5236c8f4408bb Mon Sep 17 00:00:00 2001 From: Yuri Gorshenin Date: Fri, 15 Jul 2016 16:17:33 +0300 Subject: [PATCH] [search] Honor original onResults callback. --- map/framework.cpp | 11 +++++++---- search/params.cpp | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/map/framework.cpp b/map/framework.cpp index 04947678ea..e93a57d3ba 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1067,20 +1067,23 @@ void Framework::StartInteractiveSearch(search::SearchParams const & params) { using namespace search; + auto const originalOnResults = params.m_onResults; + m_lastInteractiveSearchParams = params; m_lastInteractiveSearchParams.SetForceSearch(false); m_lastInteractiveSearchParams.SetMode(search::Mode::Viewport); m_lastInteractiveSearchParams.SetSuggestsEnabled(false); - m_lastInteractiveSearchParams.m_onResults = [this](Results const & results) - { + m_lastInteractiveSearchParams.m_onResults = [this, originalOnResults](Results const & results) { if (!results.IsEndMarker()) { - GetPlatform().RunOnGuiThread([this, results]() - { + GetPlatform().RunOnGuiThread([this, results]() { if (IsInteractiveSearchActive()) FillSearchResultsMarks(results); }); } + + if (originalOnResults) + originalOnResults(results); }; UpdateUserViewportChanged(); } diff --git a/search/params.cpp b/search/params.cpp index 1c751356fb..fa47eb86c7 100644 --- a/search/params.cpp +++ b/search/params.cpp @@ -8,7 +8,9 @@ namespace search { SearchParams::SearchParams() - : m_searchRadiusM(-1.0) + : m_lat(0.0) + , m_lon(0.0) + , m_searchRadiusM(-1.0) , m_mode(Mode::Everywhere) , m_forceSearch(false) , m_validPos(false)