Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebUI: Fix memory leak in context menus
This PR fixes a memory leak in context menus. Previously, for some reason, each menu retained references to its target elements without utilizing them further. Since the targets property was accessible/reachable from the root (window object), these references persisted even after the elements were removed from the DOM, preventing them from being garbage collected. It's easily reproducible - just add a decent amount of torrents, switch between categories multiple times, then capture heap/detached elements snapshot in the Memory tab (Chrome dev tools). The number of detached elements will continue to increase after each category switch and they won't be cleaned up. [More context](https://github.com/qbittorrent/qBittorrent/pull/22220/files#r1941137796) PR #22234.
- Loading branch information