Fix stack corruption when exiting an app (the app was destroyed while it was executing the button handler).

This commit is contained in:
Jean-François Milants 2021-06-10 21:19:11 +02:00
parent ff00873f97
commit caca6a5cff
2 changed files with 10 additions and 1 deletions

View File

@ -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) {

View File

@ -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;
};
}
}