Root cause: every fullscreen exit destroyed the AVPlayerView, triggering
CoreMedia's FigNotificationCenterRemoveWeakListeners which races with
the main thread's autorelease pool drain. No amount of nil-ing the
player reference or delaying the close could prevent this race.
Solution: the fullscreen NSWindow + AVPlayerView are created ONCE on
first use and never destroyed. Toggle uses orderFront/orderOut instead
of makeKeyAndOrderFront/close. The AVPlayerView stays alive for the
entire app lifetime, so CoreMedia teardown never happens during toggle.
Also:
- Removed onDisappear { bridge.cleanup() } — cleanup during app
termination races with autorelease pool drain. Process exit handles
all teardown correctly.
- Double-click exit uses DispatchQueue.main.async to avoid calling
toggleFullscreen from inside the event monitor callback.
- isReleasedWhenClosed = false on fullscreen window