MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / onCreate

Method onCreate

Tactility/Source/app/ElfApp.cpp:133–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131 explicit ElfApp(std::string appPath) : appPath(std::move(appPath)) {}
132
133 void onCreate(AppContext& appContext) override {
134 // Because we use global variables, we have to ensure that we are not starting 2 apps in parallel
135 // We use a ScopedLock so we don't have to safeguard all branches
136 auto lock = staticParametersLock->asScopedLock();
137 lock.lock();
138
139 staticParametersSetCount = 0;
140 if (!startElf()) {
141 stop();
142 auto message = lastError.empty() ? "Application failed to start." : std::format("Application failed to start: {}", lastError);
143 alertdialog::start("Error", message);
144 return;
145 }
146
147 if (staticParametersSetCount == 0) {
148 stop();
149 alertdialog::start("Error", "Application failed to start: application failed to register itself");
150 return;
151 }
152
153 manifest = std::make_unique<Parameters>(staticParameters);
154 lock.unlock();
155
156 if (manifest->createData != nullptr) {
157 data = manifest->createData();
158 }
159
160 if (manifest->onCreate != nullptr) {
161 manifest->onCreate(&appContext, data);
162 }
163 }
164
165 void onDestroy(AppContext& appContext) override {
166 LOGGER.info("Cleaning up app");

Callers

nothing calls this directly

Calls 5

asScopedLockMethod · 0.80
stopFunction · 0.70
startFunction · 0.70
lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected