diff options
author | Jean-François Milants <jf@codingfield.com> | 2021-06-10 21:19:11 +0200 |
---|---|---|
committer | Jean-François Milants <jf@codingfield.com> | 2021-06-10 21:19:11 +0200 |
commit | caca6a5cff0025df80241a09baab28e49720ddf8 (patch) | |
tree | bd1ff044c25fc3c1b3ba85565ff5206ee7188626 /src | |
parent | ff00873f974cb1400acf7721251167634e60107a (diff) |
Fix stack corruption when exiting an app (the app was destroyed while it was executing the button handler).
Diffstat (limited to 'src')
-rw-r--r-- | src/displayapp/DisplayApp.cpp | 8 | ||||
-rw-r--r-- | src/displayapp/DisplayApp.h | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index ba6dfbd2..99758c92 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -205,6 +205,11 @@ void DisplayApp::Refresh() { } } + if(nextApp != Apps::None) { + LoadApp(nextApp, nextDirection); + nextApp = Apps::None; + } + if (state != States::Idle && touchMode == TouchModes::Polling) { auto info = touchPanel.GetTouchInfo(); if (info.action == 2) { // 2 = contact @@ -223,7 +228,8 @@ void DisplayApp::RunningState() { } void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) { - LoadApp(app, direction); + nextApp = app; + nextDirection = direction; } void DisplayApp::ReturnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) { diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 65abd41a..73a7cc36 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -111,6 +111,9 @@ namespace Pinetime { void ReturnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent); void LoadApp(Apps app, DisplayApp::FullRefreshDirections direction); void PushMessageToSystemTask(Pinetime::System::Messages message); + + Apps nextApp = Apps::None; + DisplayApp::FullRefreshDirections nextDirection; }; } } |