chore: move event loop recreation check into backends themselves

This commit is contained in:
Mads Marquart 2025-05-26 06:48:52 +02:00 committed by GitHub
parent 5f2c7350e9
commit 8ad016362a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 64 additions and 25 deletions

View file

@ -148,10 +148,10 @@ impl EventLoop {
static mut SINGLETON_INIT: bool = false;
unsafe {
assert!(
!SINGLETON_INIT,
"Only one `EventLoop` is supported on iOS. `EventLoopProxy` might be helpful"
);
if SINGLETON_INIT {
// Required, AppState is global state, and event loop can only be run once.
return Err(EventLoopError::RecreationAttempt);
}
SINGLETON_INIT = true;
}