You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(js-port): order pointer press/release on nativeEdt to recover dropped releases
ParparVM compiles every Java method to a JS generator. JSO calls inside
``onMouseDown`` / ``onMouseUp`` (``getClientX``, ``focusInputElement``,
``evt.preventDefault``) yield while the host bridge round-trips, so while
``onMouseDown`` is suspended the worker can dequeue and start ``onMouseUp``
for the same click. If onMouseUp finishes first, its
``nativeCallSerially(pointerReleased)`` lands on ``nativeEdt`` BEFORE
onMouseDown's matching press. The EDT then sees POINTER_RELEASED before
POINTER_PRESSED, drops the release because ``eventForm == null`` (Display.java
POINTER_RELEASED handler), and the matching ``Button.released`` never fires
-- so a Hello-button click never shows its Dialog and PR #4795 freezes.
Two coordinated changes close the race:
1. Set ``mouseDown=true`` synchronously at handler entry (before any JSO
yield), so an interleaved onMouseUp doesn't early-return on a stale
``!isMouseDown()`` check and silently drop the release.
2. Deferred-release pattern. onMouseDown sets ``pressInFlight=true``
synchronously and clears it in the press's nativeCallSerially completion
hook. onMouseUp checks the flag at dispatch time: if a press is still in
flight, it stashes the release in ``deferredRelease`` and returns; the
press's completion hook then runs the deferred release. This guarantees
POINTER_RELEASED reaches Display.inputEventStack AFTER its matching
POINTER_PRESSED. ``Object.wait()`` would also work but blocks the worker's
listener thread -- if the EDT is later inside ``invokeAndBlock`` (Dialog
modal) the listener won't unblock until the dialog disposes, starving
every subsequent pointerdown.
After this change Hello reliably opens its Dialog, and the previously seen
transparent-hole regression on rapid drag/click sequences (Test 2 of
test-initializr-interaction.mjs) clears too -- it was the same dropped-
release symptom on a different surface.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments