Skip to content

Commit b070099

Browse files
committed
Fix NullReferenceException when unregistering folding manager after the document was detached from the TextArea.
1 parent b98689a commit b070099

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

ICSharpCode.AvalonEdit/Rendering/CollapsedLineSection.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ public void Uncollapse()
8686
if (start == null)
8787
return;
8888

89-
heightTree.Uncollapse(this);
89+
if (!heightTree.IsDisposed) {
90+
heightTree.Uncollapse(this);
9091
#if DEBUG
91-
heightTree.CheckProperties();
92+
heightTree.CheckProperties();
9293
#endif
94+
}
9395

9496
start = null;
9597
end = null;

ICSharpCode.AvalonEdit/Rendering/HeightTree.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ public void Dispose()
7373
this.weakLineTracker = null;
7474
}
7575

76+
public bool IsDisposed {
77+
get {
78+
return root == null;
79+
}
80+
}
81+
7682
double defaultLineHeight;
7783

7884
public double DefaultLineHeight {

0 commit comments

Comments
 (0)