From 764ec6d83b08bd8103ae9f688f00c0469a40606b Mon Sep 17 00:00:00 2001 From: ExMix Date: Tue, 18 Nov 2014 10:50:27 +0300 Subject: [PATCH] [core] correct touch process when gui subsystem was not be initialized --- gui/controller.cpp | 16 ++++++++++++++-- gui/controller.hpp | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gui/controller.cpp b/gui/controller.cpp index 4a5b7ae2e7..ff70718f40 100644 --- a/gui/controller.cpp +++ b/gui/controller.cpp @@ -48,6 +48,9 @@ namespace gui bool Controller::OnTapStarted(m2::PointD const & pt) { + if (GetCacheScreen() == nullptr) + return false; + shared_ptr e = SelectTopElement(pt, true); if (e) { @@ -62,6 +65,9 @@ namespace gui bool Controller::OnTapMoved(m2::PointD const & pt) { + if (GetCacheScreen() == nullptr) + return false; + if (m_focusedElement) { if (!m_LastTapCancelled) @@ -84,6 +90,9 @@ namespace gui bool Controller::OnTapEnded(m2::PointD const & pt) { + if (GetCacheScreen() == nullptr) + return false; + if (m_focusedElement) { // re-checking, whether we are above the gui element. @@ -109,6 +118,9 @@ namespace gui bool Controller::OnTapCancelled(m2::PointD const & pt) { + if (GetCacheScreen() == nullptr) + return false; + if (m_focusedElement) { m_focusedElement->onTapCancelled(pt); @@ -163,7 +175,7 @@ namespace gui m_GlyphCache = 0; m_Density = graphics::EDensityLDPI; m_InvalidateFn = TInvalidateFn(); - m_CacheScreen = 0; + m_CacheScreen = nullptr; PurgeElements(); @@ -172,7 +184,7 @@ namespace gui void Controller::DrawFrame(graphics::Screen * screen) { - if (m_CacheScreen == NULL) + if (m_CacheScreen == nullptr) return; screen->beginFrame(); diff --git a/gui/controller.hpp b/gui/controller.hpp index ca370bb661..f9f99496ea 100644 --- a/gui/controller.hpp +++ b/gui/controller.hpp @@ -77,7 +77,7 @@ namespace gui StringsBundle const * m_bundle; /// Screen, which is used to cache gui::Elements into display lists. - graphics::Screen * m_CacheScreen; + graphics::Screen * m_CacheScreen = nullptr; /// Should we call the onTapEnded when the tap finished(we should /// not if the tap was cancelled while moving).