Skip to content

Conversation

@miroiu
Copy link
Owner

@miroiu miroiu commented Jun 5, 2025

📝 Description of the Change

Fix memory leak caused by auto panning timer.

Related #218

🐛 Possible Drawbacks

None that I can think of.

@miroiu miroiu requested a review from Copilot June 6, 2025 16:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a memory leak by ensuring the auto-panning timer is stopped and its event handlers removed when the editor unloads. Key changes include stopping/clearing the timer on unload, refactoring the timer setup/teardown logic, and updating related example code and documentation.

  • Subscribes to the editor’s Unloaded event and disables auto-panning when the control is unloaded
  • Refactors OnDisableAutoPanningChanged to clear existing timers and detach its tick handler before recreating
  • Updates example project to use a dedicated OperationsMenuHandler and adds a changelog entry

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
Nodify/Editor/NodifyEditor.cs Added Unloaded subscription and handler to disable auto-panning
Nodify/Editor/NodifyEditor.Panning.cs Refactored timer logic: clear old timer, detach handler, recreate
Examples/Nodify.Calculator/EditorView.xaml.cs Introduced OperationsMenuHandler and updated registration logic
CHANGELOG.md Added entry for auto-panning timer memory‐leak fix

@miroiu miroiu merged commit 2fcdf95 into master Jun 6, 2025
4 checks passed
@miroiu miroiu deleted the fix/218-memory-leak branch June 6, 2025 17:49
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