MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / replaceActivity

Method replaceActivity

src/activities/ActivityManager.cpp:158–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158void 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
172void ActivityManager::goToFileTransfer() {
173 replaceActivity(std::make_unique<CrossPointWebServerActivity>(renderer, mappedInput));

Callers 7

setupFunction · 0.80
launchKOReaderSyncMethod · 0.80
onGoToEpubReaderMethod · 0.80
onGoToBmpViewerMethod · 0.80
onGoToXtcReaderMethod · 0.80
onGoToTxtReaderMethod · 0.80
handleSelectionMethod · 0.80

Calls 1

onEnterMethod · 0.45

Tested by

no test coverage detected