MCPcopy Create free account
hub / github.com/SFML/SFML / onDestroy

Function onDestroy

src/SFML/Main/MainAndroid.cpp:299–333  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

297
298////////////////////////////////////////////////////////////
299void onDestroy(ANativeActivity* activity)
300{
301 // Retrieve our activity states from the activity instance
302 sf::priv::ActivityStates& states = retrieveStates(*activity);
303
304 // Send an event to warn people the activity is being destroyed
305 {
306 const std::lock_guard lock(states.mutex);
307
308 // If the main thread hasn't yet finished, send the event and wait for
309 // it to finish.
310 if (!states.mainOver)
311 states.forwardEvent(sf::Event::Closed{});
312 }
313
314 // Wait for the main thread to be terminated
315 states.mutex.lock();
316
317 while (!states.terminated)
318 {
319 states.mutex.unlock();
320 sf::sleep(sf::milliseconds(20));
321 states.mutex.lock();
322 }
323
324 states.mutex.unlock();
325
326 // Delete our allocated states
327 delete &states;
328
329 // Reset the activity pointer for all modules
330 sf::priv::resetActivity(nullptr);
331
332 // The application should now terminate
333}
334
335////////////////////////////////////////////////////////////
336void onNativeWindowCreated(ANativeActivity* activity, ANativeWindow* window)

Callers

nothing calls this directly

Calls 3

sleepFunction · 0.85
resetActivityFunction · 0.85
forwardEventMethod · 0.80

Tested by

no test coverage detected