From f3503e6844745775ee91df0b89577aa2366a41d1 Mon Sep 17 00:00:00 2001 From: Erwin Ried <1091420+eried@users.noreply.github.com> Date: Fri, 25 Sep 2020 03:34:05 +0200 Subject: [PATCH] Fix for the freezing when no on_touch_release function --- firmware/common/ui_widget.cpp | 6 +++--- firmware/common/ui_widget.hpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/firmware/common/ui_widget.cpp b/firmware/common/ui_widget.cpp index 90c544fec..12bf19270 100644 --- a/firmware/common/ui_widget.cpp +++ b/firmware/common/ui_widget.cpp @@ -913,12 +913,12 @@ bool Button::on_touch(const TouchEvent event) { case TouchEvent::Type::End: set_highlighted(false); set_dirty(); - if( on_select && !instant_exec_ ) { - on_select(*this); - } if( on_touch_release) { on_touch_release(*this); } + if( on_select && !instant_exec_ ) { + on_select(*this); + } return true; default: diff --git a/firmware/common/ui_widget.hpp b/firmware/common/ui_widget.hpp index 134f31109..f66da710c 100644 --- a/firmware/common/ui_widget.hpp +++ b/firmware/common/ui_widget.hpp @@ -378,8 +378,8 @@ private: class Button : public Widget { public: std::function on_select { }; - std::function on_touch_release { nullptr }; // Executed when releasing touch, after on_select. - std::function on_touch_press { nullptr }; // Executed when touching, before on_select. + std::function on_touch_release { }; // Executed when releasing touch, after on_select. + std::function on_touch_press { }; // Executed when touching, before on_select. std::function on_dir { }; std::function on_highlight { };