Skip to content

Conversation

@yugalkaushik
Copy link

@yugalkaushik yugalkaushik commented Dec 26, 2025

Fixes #4901

Problem

Widget windows add three event listeners to document when created (mouseup, mousemove, mousedown) but these listeners are never removed when the widget is closed.
The cleanup code exists in the close() method, but all 20 widgets in the codebase override onclose() and call destroy() directly, so the cleanup code never runs.
This causes a memory leak where every widget open/close cycle leaves 3 orphaned event listeners attached to document. In longer sessions, this leads to degraded performance as hundreds of unused listeners accumulate.

Solution

Moved the removeEventListener calls from close() to destroy() so cleanup happens regardless of which method is called.

Testing

Before
image

After
image

@github-actions
Copy link
Contributor

❌ Some Jest tests failed. Please check the logs and fix the issues before merging.

Failed Tests:

synthutils.test.js

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.

Memory leak: Event listeners not removed when widget windows are closed

1 participant