Skip to content

fix(android): prevent draw errors on view dispose#243

Merged
mfazekas merged 2 commits intofeat/rive-ios-experimentalfrom
fix/android-dispose-draw-race
May 5, 2026
Merged

fix(android): prevent draw errors on view dispose#243
mfazekas merged 2 commits intofeat/rive-ios-experimentalfrom
fix/android-dispose-draw-race

Conversation

@mfazekas
Copy link
Copy Markdown
Collaborator

@mfazekas mfazekas commented May 5, 2026

Navigating away from a Rive screen produced:

Draw failed: Artboard instance is null
Failed to swap EGL buffers: EGL_BAD_SURFACE

The command queue processes commands in order: close(artboard) then draw(artboard). The draw finds the artboard already closed.

Fix: don't call .close() in dispose() — just null the handles and stop the render loop. The command queue drains naturally and resources are cleaned up by GC.

Test plan

  • Open any Rive example → navigate back → no errors in logcat

mfazekas added 2 commits May 5, 2026 08:17
Don't close artboard/surface in dispose() — the command queue may
still have a pending draw command referencing them. Just null the
handles and stop the render loop. Resources are cleaned up by GC.
@mfazekas mfazekas merged commit ff984c6 into feat/rive-ios-experimental May 5, 2026
11 checks passed
@mfazekas mfazekas deleted the fix/android-dispose-draw-race branch May 5, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant