Skip to content

fix(core): guard event unlisten script when listener entry is missing - #15800

Open
lazerg wants to merge 1 commit into
tauri-apps:devfrom
lazerg:fix/issue-15799-guard-unlisten-missing-entry
Open

fix(core): guard event unlisten script when listener entry is missing#15800
lazerg wants to merge 1 commit into
tauri-apps:devfrom
lazerg:fix/issue-15799-guard-unlisten-missing-entry

Conversation

@lazerg

@lazerg lazerg commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

listen() resolves once Rust answers its invoke, but the webview registry entry is written by a separate, later eval, so the returned unlisten function can run before that entry exists. In that window the generated unlisten script read handlerId off an undefined entry and threw, and because that throw happens before _unlisten sends the backend plugin:event|unlisten, the listener stayed registered and kept firing. This checks the entry is present before reading it, the same guard the event delivery script already uses.

Fixes #15799

@lazerg
lazerg requested a review from a team as a code owner July 30, 2026 09:53
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.

unlisten throws and leaks the listener when called before the registration eval lands (listeners[eventId] undefined)

1 participant