Merge pull request #1162 from rokuz/fixed-layer-renderer-crash

Fixed crash in layer renderer
This commit is contained in:
Dmitry Yunitsky 2015-12-29 10:13:40 +03:00
commit a6d040b95b
3 changed files with 11 additions and 1 deletions

View file

@ -44,9 +44,18 @@ void LayerRenderer::Merge(ref_ptr<LayerRenderer> other)
{
TRenderers::iterator it = m_renderers.find(r.first);
if (it != m_renderers.end())
{
it->second = move(r.second);
if (m_activeOverlay != nullptr && m_activeOverlayWidget == r.first)
{
m_activeOverlay->OnTapEnd();
m_activeOverlay = nullptr;
}
}
else
{
m_renderers.insert(make_pair(r.first, move(r.second)));
}
}
other->m_renderers.clear();
@ -82,6 +91,7 @@ bool LayerRenderer::OnTouchDown(m2::RectD const & touchArea)
m_activeOverlay = r.second->ProcessTapEvent(touchArea);
if (m_activeOverlay != nullptr)
{
m_activeOverlayWidget = r.first;
m_activeOverlay->OnTapBegin();
return true;
}

View file

@ -46,6 +46,7 @@ private:
TRenderers m_renderers;
ref_ptr<gui::Handle> m_activeOverlay;
EWidget m_activeOverlayWidget = EWidget::WIDGET_RULER;
};
class LayerCacher

View file

@ -495,7 +495,6 @@ bool UserEventStream::TouchMove(array<Touch, 2> const & touches, double timestam
break;
case STATE_TAP_DETECTION:
case STATE_WAIT_DOUBLE_TAP:
ASSERT_EQUAL(touchCount, 1, ());
if (m_startDragOrg.SquareLength(touches[0].m_location) > dragThreshold)
CancelTapDetector();
else