| 156 | } |
| 157 | |
| 158 | void ActivityManager::replaceActivity(std::unique_ptr<Activity>&& newActivity) { |
| 159 | // Note: no lock here, this is usually called by loop() and we may run into deadlock |
| 160 | if (currentActivity) { |
| 161 | // Defer launch if we're currently in an activity, to avoid deleting the current activity |
| 162 | // leading to the "delete this" problem |
| 163 | pendingActivity = std::move(newActivity); |
| 164 | pendingAction = PendingAction::Replace; |
| 165 | } else { |
| 166 | // No current activity, safe to launch immediately |
| 167 | currentActivity = std::move(newActivity); |
| 168 | currentActivity->onEnter(); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | void ActivityManager::goToFileTransfer() { |
| 173 | replaceActivity(std::make_unique<CrossPointWebServerActivity>(renderer, mappedInput)); |
no test coverage detected