mirror of
https://github.com/atom/atom.git
synced 2026-02-08 05:35:04 -05:00
Correctly remove block decorations whose markers have been destroyed
In https://github.com/atom/atom/pull/15503 we mistakenly assumed `marker.isValid` accounted only for the validity of the marker. However, that method returns `false` also for markers that are valid but have been destroyed. As a result, the editor component was mistakenly not removing block decorations associated with such markers. With this commit we will rely on the local `wasValid` variable instead. If its value is `true`, it means that the block decoration has been accounted for in the `lineTopIndex` and must, as a result, be cleaned up in case the marker or the decoration gets destroyed.
This commit is contained in:
@@ -2506,7 +2506,7 @@ class TextEditorComponent {
|
||||
didUpdateDisposable.dispose()
|
||||
didDestroyDisposable.dispose()
|
||||
|
||||
if (marker.isValid()) {
|
||||
if (wasValid) {
|
||||
this.blockDecorationsToMeasure.delete(decoration)
|
||||
this.heightsByBlockDecoration.delete(decoration)
|
||||
this.blockDecorationsByElement.delete(element)
|
||||
|
||||
Reference in New Issue
Block a user