Skip to content

Fix memory leak in ZenWorkspaces by adding event listener cleanup#12285

Open
JorySeverijnse wants to merge 4 commits intozen-browser:devfrom
JorySeverijnse:dev
Open

Fix memory leak in ZenWorkspaces by adding event listener cleanup#12285
JorySeverijnse wants to merge 4 commits intozen-browser:devfrom
JorySeverijnse:dev

Conversation

@JorySeverijnse
Copy link

  • Store bound event listeners as instance properties for later removal
  • Add cleanup() method with (_cleanupDone flag)
  • Remove all window listeners (TabOpen/Close/Select, resize, AppCommand, etc.)
  • Remove workspace-bookmarks-updated observer
  • Uses unload event
  • Also fixes RefPtr assignment in ZenStyleSheetCache

- Store bound event listeners as instance properties for later removal
- Add cleanup() method with (_cleanupDone flag)
- Remove all window listeners (TabOpen/Close/Select, resize, AppCommand, etc.)
- Remove workspace-bookmarks-updated observer
- Uses unload event
- Also fixes RefPtr assignment in ZenStyleSheetCache
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. Bug labels Feb 7, 2026
Add closing bracket (i accidentally removed) which otherwise would cause code to break

Signed-off-by: Jory Severijnse <jory@severijnse.eu>
revert back to previous were mModsSheet is null on LoadSheetSync failure

Signed-off-by: Jory Severijnse <jory@severijnse.eu>
@JorySeverijnse
Copy link
Author

JorySeverijnse commented Feb 7, 2026

Should be good now? Have also built the browser myself (from dev branch with my changes) without any issues

Copy link
Member

@mr-cheffy mr-cheffy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run formatting

- Use local consts with inline unload listeners instead of instance properties
- Keep bookmarks observer pattern with dedicated unload block
- Remove unnecessary _cleanupDone guard from cleanup()
- Minimal cleanup() only for listeners that can't use local closures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants