Fixed crashes in rendering

This commit is contained in:
r.kuznetsov 2018-07-18 16:46:39 +03:00 committed by Vlad Mihaylenko
parent c759831a45
commit 3620c4d4b4
3 changed files with 9 additions and 4 deletions

View file

@ -53,7 +53,7 @@ public:
ref_ptr<dp::Batcher> GetBatcher(TKey const & key)
{
auto it = m_batchers.find(key);
ASSERT(it != m_batchers.end(), ());
CHECK(it != m_batchers.end(), ());
return make_ref(it->second.first);
}

View file

@ -328,12 +328,15 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
drape_ptr<gui::LayerRenderer> renderer = std::move(msg->AcceptRenderer());
renderer->Build(make_ref(m_gpuProgramManager));
if (msg->NeedResetOldGui())
m_guiRenderer.release();
m_guiRenderer.reset();
if (m_guiRenderer == nullptr)
m_guiRenderer = std::move(renderer);
else
m_guiRenderer->Merge(make_ref(renderer));
CHECK(m_guiRenderer != nullptr, ());
m_guiRenderer->SetLayout(m_lastWidgetsLayout);
bool oldMode = m_choosePositionMode;
m_choosePositionMode = m_guiRenderer->HasWidget(gui::WIDGET_CHOOSE_POSITION_MARK);
if (oldMode != m_choosePositionMode)
@ -351,8 +354,9 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
case Message::GuiLayerLayout:
{
ASSERT(m_guiRenderer != nullptr, ());
m_guiRenderer->SetLayout(ref_ptr<GuiLayerLayoutMessage>(message)->GetLayoutInfo());
m_lastWidgetsLayout = ref_ptr<GuiLayerLayoutMessage>(message)->GetLayoutInfo();
if (m_guiRenderer != nullptr)
m_guiRenderer->SetLayout(m_lastWidgetsLayout);
break;
}

View file

@ -260,6 +260,7 @@ private:
std::array<RenderLayer, RenderState::LayersCount> m_layers;
drape_ptr<gui::LayerRenderer> m_guiRenderer;
gui::TWidgetsLayoutInfo m_lastWidgetsLayout;
drape_ptr<MyPositionController> m_myPositionController;
drape_ptr<SelectionShape> m_selectionShape;
drape_ptr<RouteRenderer> m_routeRenderer;