Skip to content

Fix: prevent duplicate mousemove listeners in WebViewPluginDemoGUI - #1694

Closed
alex-js-ltd wants to merge 1 commit into
juce-framework:developfrom
alex-js-ltd:fix/webview-plugin-demo-event-listener-leak
Closed

Fix: prevent duplicate mousemove listeners in WebViewPluginDemoGUI#1694
alex-js-ltd wants to merge 1 commit into
juce-framework:developfrom
alex-js-ltd:fix/webview-plugin-demo-event-listener-leak

Conversation

@alex-js-ltd

@alex-js-ltd alex-js-ltd commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • App previously registered a document mousemove listener directly in the component body (not inside useEffect), so a new listener was added on every re-render without the old one being removed — a listener leak.
  • Moves the listener registration into a useEffect with an empty dependency array and adds a cleanup function that removes it on unmount.

Discussed on the forum: https://forum.juce.com/t/event-listener-leak-in-the-webviewplugindemogui/69236

Test plan

  • Run the WebView plugin demo GUI and confirm mouse-move driven parameter control still works.
  • Verify only one mousemove listener is attached after multiple re-renders (e.g. via getEventListeners(document) in devtools).

@szarvas

szarvas commented Aug 4, 2026

Copy link
Copy Markdown
Member

Thank you for reporting. The change has been merged.

@szarvas szarvas closed this Aug 4, 2026
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.

2 participants