Memory leak when programatically setting the cursor position #155

Open
opened 2018-09-18 10:37:22 -05:00 by agentS · 0 comments
agentS commented 2018-09-18 10:37:22 -05:00 (Migrated from github.com)

Hi,

First of all, thank you for your great text editor.
I'm using it for building a debugger for embedded systems with multiple windows showing source code that can be opened and closed dynamically.
Each editor window consists of the Avalon editor and some buttons and text fields for searching and navigating.
Being a debugger for embedded systems I need to move the caret to the position of a changed variable once a value changes.

When closing an editor window I, of course, want to dispose all resources.
However, the following lines for moving the editor to build up an undo stack which is not disposed:

TextLocation newCursorPosition = new TextLocation
(
    manipulated.Line,
    manipulated.avalonEditor.TextArea.Caret.Location.Column
);
manipulated.avalonEditor.TextArea.Caret.Location = newCursorPosition;
manipulated.avalonEditor.TextArea.Caret.BringCaretToView();

dotMemory shows the following key retention paths blocking my object of being disposed (I unfortunately had to merge the screenshot using Paint.)
If I remove the code shown above, the disposal of my window works fine.

Key retention paths

Thanks!

Hi, First of all, thank you for your great text editor. I'm using it for building a debugger for embedded systems with multiple windows showing source code that can be opened and closed dynamically. Each editor window consists of the Avalon editor and some buttons and text fields for searching and navigating. Being a debugger for embedded systems I need to move the caret to the position of a changed variable once a value changes. When closing an editor window I, of course, want to dispose all resources. However, the following lines for moving the editor to build up an undo stack which is not disposed: TextLocation newCursorPosition = new TextLocation ( manipulated.Line, manipulated.avalonEditor.TextArea.Caret.Location.Column ); manipulated.avalonEditor.TextArea.Caret.Location = newCursorPosition; manipulated.avalonEditor.TextArea.Caret.BringCaretToView(); dotMemory shows the following key retention paths blocking my object of being disposed (I unfortunately had to merge the screenshot using Paint.) If I remove the code shown above, the disposal of my window works fine. ![Key retention paths](https://user-images.githubusercontent.com/5032736/45698936-7729fa00-bb69-11e8-8083-6274e252913f.png) Thanks!
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-icsharpcode/AvalonEdit#155
No description provided.