Skip to content

Don't despawn render window entities when the raw handle is removed - #25684

Open
beicause wants to merge 1 commit into
bevyengine:mainfrom
beicause:fix-android-window-resume
Open

Don't despawn render window entities when the raw handle is removed#25684
beicause wants to merge 1 commit into
bevyengine:mainfrom
beicause:fix-android-window-resume

Conversation

@beicause

@beicause beicause commented Sep 4, 2026

Copy link
Copy Markdown
Member

Objective

Fixes #25682

Solution

Don't despawn render window entities when the raw handle is removed. Instead remove the window components.

Testing

I tested the android example

@beicause beicause added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen O-Android Specific to the Android mobile operating system P-Regression Functionality that used to work but no longer does. Add a test for this! S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 4, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Sep 4, 2026
Removing `RawHandleWrapper` is not necessarily terminal: on Android the
native window is destroyed (and its handle removed) when the app suspends,
but the window entity survives and is given a new handle on resume.
Despawning the synced render entity left the main world entity's
`SubEntity` pointing at a dead entity, and the next round of extraction
panicked with `Entity despawned` when reusing it.

The render entity is only ever despawned by the entity sync system once
the main world window entity is actually destroyed. Tear down the surface
and drop the extracted window data instead; extraction and
`create_surfaces` recreate them whenever the window has a new
`RawHandleWrapper`.
@beicause
beicause force-pushed the fix-android-window-resume branch from b054968 to d787cc7 Compare September 4, 2026 14:47
@beicause
beicause requested a review from IceSentry September 4, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-Android Specific to the Android mobile operating system P-Regression Functionality that used to work but no longer does. Add a test for this! S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

Android resume panics after the render surface is recreated

2 participants