From 3a938236d48430cb77660f15d712f7bc129d9539 Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Sun, 2 May 2021 22:12:09 +0100 Subject: Fix a possible double free in StopWatch::Refresh. The lv_obj_del is called on btnStopLap when transitioning to the initial state, however the variable isn't then set to null. A subsequent call to Refresh would attempt to delete the already freed object. This could be triggered by stopping the stop watch, then pressing the physical button on the watch. Fixes https://github.com/JF002/InfiniTime/issues/315 --- src/displayapp/screens/StopWatch.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/displayapp/screens') diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index e06981af..d7cd20c3 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -115,8 +115,9 @@ bool StopWatch::Refresh() { // Init state when an user first opens the app // and when a stop/reset button is pressed case States::Init: { - if (btnStopLap) { + if (btnStopLap != nullptr) { lv_obj_del(btnStopLap); + btnStopLap = nullptr; } // The initial default value lv_label_set_text(time, "00:00"); -- cgit v1.2.3 From 9a8824c35a03a6705ad629c1285f2caa87e36d89 Mon Sep 17 00:00:00 2001 From: Stoian Minaiev Date: Mon, 10 May 2021 15:13:33 +0300 Subject: SystemInfo app screen First screen. Let the build date and build time string be centered as well as the others --- src/displayapp/screens/SystemInfo.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/displayapp/screens') diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index f6e8d61a..ab349d7b 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -70,8 +70,8 @@ std::unique_ptr SystemInfo::CreateScreen1() { "#FFFF00 InfiniTime#\n\n" "#444444 Version# %ld.%ld.%ld\n\n" "#444444 Build date#\n" - "\t%s\n" - "\t%s\n", + "%s\n" + "%s\n", Version::Major(), Version::Minor(), Version::Patch(), @@ -242,4 +242,4 @@ std::unique_ptr SystemInfo::CreateScreen5() { lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); return std::unique_ptr(new Screens::Label(4, 5, app, label)); -} \ No newline at end of file +} -- cgit v1.2.3