aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/DisplayApp.cpp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-06-10 21:19:11 +0200
committerJean-François Milants <jf@codingfield.com>2021-06-10 21:19:11 +0200
commitcaca6a5cff0025df80241a09baab28e49720ddf8 (patch)
treebd1ff044c25fc3c1b3ba85565ff5206ee7188626 /src/displayapp/DisplayApp.cpp
parentff00873f974cb1400acf7721251167634e60107a (diff)
Fix stack corruption when exiting an app (the app was destroyed while it was executing the button handler).
Diffstat (limited to 'src/displayapp/DisplayApp.cpp')
-rw-r--r--src/displayapp/DisplayApp.cpp8
1 files changed, 7 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) {