Outputs: Don't let a removal skip the wait while the graphics come back

The outputs were only marked live after deviceRestored(), so a
Native_RemoveOutputAndWait() that came in while it was recreating their
swapchains returned at once. On Android the surface could then be freed
while a swapchain was being made on it (unplugging the TV as the app
returns to the foreground). Mark them live before the queue is
processed, so such a removal waits for the next frame.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-22 22:59:29 +02:00
1 parent a0e0115e65
commit 3e53d4bde1
1 file changed
+3 -1
+3 -1
View File
@@ -995,10 +995,12 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) {
g_screenManager->setUIContext(uiContext);
g_screenManager->setPostRenderCallback(&CallbackPostRender, nullptr);
// Live before the queue is processed: a removal that comes in while the outputs' swapchains are being
// recreated has to wait for the next frame, as its surface may be gone once it returns.
SetOutputsLive(true);
// An output removed while there was no device can't be recreated, its surface may be gone.
ProcessOutputRequests();
g_screenManager->deviceRestored(g_draw);
SetOutputsLive(true);
g_audioBackend = System_CreateAudioBackend();
if (g_audioBackend) {