Skip to content

fix: avoid NPE when canceling a JavaScript invocation of a closed UI (#25095) (CP:24.10) - #25214

Open
mshabarov wants to merge 1 commit into
24.10from
cherry-pick-25095-to-24.10
Open

fix: avoid NPE when canceling a JavaScript invocation of a closed UI (#25095) (CP:24.10)#25214
mshabarov wants to merge 1 commit into
24.10from
cherry-pick-25095-to-24.10

Conversation

@mshabarov

Copy link
Copy Markdown
Contributor

Invocations owned by an invisible component are retained in the UI's queue and get a detach listener registered for them. Registering that listener installs a handler on the invocation itself, and the handler stays attached to the invocation for the rest of its lifetime, since there is no way to unsubscribe it.

A component that keeps the PendingJavaScriptResult and cancels it after being reused in another UI therefore runs the handler installed by the closed UI, which dereferences its cleared session. Return early when the UI no longer has a session, as its invocation queue has already been released by then.

Also release the retained invocations when the UI is closed, so that the queue and the detach listener registrations on the state nodes do not outlive the UI when a detach listener fails and prevents the ones after it from running.

Fixes #25092

(cherry picked from commit 8f059b2)

…25095)

Invocations owned by an invisible component are retained in the UI's
queue and get a detach listener registered for them. Registering that
listener installs a handler on the invocation itself, and the handler
stays attached to the invocation for the rest of its lifetime, since
there is no way to unsubscribe it.

A component that keeps the PendingJavaScriptResult and cancels it after
being reused in another UI therefore runs the handler installed by the
closed UI, which dereferences its cleared session. Return early when the
UI no longer has a session, as its invocation queue has already been
released by then.

Also release the retained invocations when the UI is closed, so that the
queue and the detach listener registrations on the state nodes do not
outlive the UI when a detach listener fails and prevents the ones after
it from running.

Fixes #25092

(cherry picked from commit 8f059b2)
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

1 296 files  ±0  1 296 suites  ±0   1h 12m 32s ⏱️ +26s
8 961 tests +3  8 899 ✅ +3  62 💤 ±0  0 ❌ ±0 
9 298 runs  +2  9 229 ✅ +2  69 💤 ±0  0 ❌ ±0 

Results for commit 7c8fb45. ± Comparison against base commit 7cc62d0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants