fix(app): keep the app alive on Emscripten after bj_run_app returns #182

Merged
OragonEfreet merged 1 commit from fix/emscripten-app-lifetime into main 2026-09-27 17:03:08 +02:00
Owner

On Emscripten, bj_run_app registers em_step with the browser loop and returns straight away.
Since c4f554a it then released the time subsystem and freed the app as the native path does, leaving em_step with a dangling pointer.
The first frame still drew, but step no longer ran, so bj_dispatch_events was never called and every game ignored input.

em_step now owns the app once the loop is registered and releases it on quit, after teardown.

On Emscripten, bj_run_app registers em_step with the browser loop and returns straight away. Since c4f554a it then released the time subsystem and freed the app as the native path does, leaving em_step with a dangling pointer. The first frame still drew, but step no longer ran, so bj_dispatch_events was never called and every game ignored input. em_step now owns the app once the loop is registered and releases it on quit, after teardown.
fix(app): keep the app alive on Emscripten after bj_run_app returns
All checks were successful
C++ Compatibility / C++ Compatibility Check (pull_request) Successful in 8s
Documentation / build-docs (pull_request) Successful in 12s
QA / cert (pull_request) Successful in 30s
Build and Test / linux-linux-gcc / shared (pull_request) Successful in 17s
Build and Test / linux-linux-gcc / static (pull_request) Successful in 18s
Build and Test / linux-windows-mingw / shared (pull_request) Successful in 26s
Build and Test / linux-windows-mingw / static (pull_request) Successful in 26s
5b519b1409
On Emscripten, bj_run_app registers em_step with the browser loop and
returns straight away. Since c4f554a it then released the time subsystem
and freed the app as the native path does, leaving em_step with a
dangling pointer. The first frame still drew, but step no longer ran,
so bj_dispatch_events was never called and every game ignored input.

em_step now owns the app once the loop is registered and releases it
on quit, after teardown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OragonEfreet deleted branch fix/emscripten-app-lifetime 2026-09-27 17:03:08 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
OragonEfreet/banjo!182
No description provided.