pcbjam/wasm/bindings
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Gergő Törcsvári 32218122c3
fix(wasm): never swap to a fiber while an Asyncify context is parked
Opening a large board could kill the editor runtime outright: "index out of
bounds" / "unreachable executed" / "indirect call signature mismatch", after
which every later focus/key event trapped. Reported in prod against a big
uploaded board, and correlated by the reporter with the moment the presence
WebSocket connects.

That correlation is the tell. Presence/collab work enters the wasm through
runOnFiber -> COROUTINE::Call, i.e. emscripten_fiber_swap, whose stop_unwind
corrupts Asyncify's single currData slot when ANOTHER context is already
parked there. docs/features/async/13 pins the invariant: exactly one
unwind/rewind transition in flight, and prescribes "a single shared is-a-
transition-in-flight guard the pumps consult before re-driving".

Normally the slot is free when fibers drain: the main loop's per-frame
wxWasmYieldToBrowser completes every frame, so drainFibers runs between
yields. It is NOT free when a nested/modal pump tick drives ProcessEvents
while the chain that opened the modal is parked deeper down — precisely a big
board open (progress dialog over a parked load). The wx dispatch interlock
does not cover this: the modal parks deliberately zero its count so their own
pump may dispatch.

So gate the swap itself: drainFibers defers (re-CallAfter) while
asyncifyInFlight(). Bodies are viewport/overlay/apply work, so waiting out the
park costs latency, never correctness.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H8jo7zz1ZwzYpjJ64UZKN4
2026-07-29 15:29:36 +02:00
..
calculator_embind.cpp add calculator build 2026-05-28 17:28:17 +02:00
collab_common.h fix(wasm): never swap to a fiber while an Asyncify context is parked 2026-07-29 15:29:36 +02:00
collab_presence_core.h comments-ux: figma bubble pins, floating panel, seen/reactions/mentions UI, theme follow (0001 A–E + 0002) 2026-07-24 13:21:22 +02:00
collab_presence_style.h comments-ux: figma bubble pins, floating panel, seen/reactions/mentions UI, theme follow (0001 A–E + 0002) 2026-07-24 13:21:22 +02:00
eeschema_embind.cpp comments-ux: figma bubble pins, floating panel, seen/reactions/mentions UI, theme follow (0001 A–E + 0002) 2026-07-24 13:21:22 +02:00
kicad_editor_embind.cpp fix(theme): stop the boot theme re-send from resurrecting hidden chrome 2026-07-27 18:48:25 +02:00
kicad_tools_embind.cpp feat: kicad_tools headless CLI 2026-07-10 19:09:01 +02:00
pcbjam_libs_reload.h libs: peer lib edits reach the running editor + "placed symbol updated" toast 2026-07-10 09:26:07 +02:00
pcbjam_theme.h fix(theme): stop the boot theme re-send from resurrecting hidden chrome 2026-07-27 18:48:25 +02:00
pcbnew_embind.cpp comments-ux: figma bubble pins, floating panel, seen/reactions/mentions UI, theme follow (0001 A–E + 0002) 2026-07-24 13:21:22 +02:00
pl_editor_embind.cpp feat(read-only-viewer): editor viewer mode + kicadSetReadOnly binding 2026-07-13 12:48:35 +02:00