Skip to content

Commit 784732d

Browse files
committed
fix: add destroyed prop to DecorationManagement
1 parent b9e351c commit 784732d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/decoration-management.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ export default class DecorationManagement {
7070
* @access private
7171
*/
7272
this.decorationDestroyedSubscriptions = new Map()
73+
74+
// is set to true when a minimapElement is destroyed
75+
this.destroyed = false
7376
}
7477

7578
/**
@@ -322,7 +325,7 @@ export default class DecorationManagement {
322325
* @emits {did-change} when the decoration is created successfully
323326
*/
324327
decorateMarker (marker, decorationParams) {
325-
if (this.minimap.destroyed || marker == null) { return }
328+
if (this.destroyed || this.minimap.destroyed || marker == null) { return }
326329

327330
const { id } = marker
328331

@@ -435,7 +438,7 @@ export default class DecorationManagement {
435438
* @access private
436439
*/
437440
emitDecorationChanges (type, decoration) {
438-
if (this.minimap.editorDestroyed()) { return }
441+
if (this.destroyed || this.minimap.editorDestroyed()) { return }
439442

440443
this.invalidateDecorationForScreenRowsCache()
441444

@@ -535,7 +538,7 @@ export default class DecorationManagement {
535538
for (let i = 0, len = decorations.length; i < len; i++) {
536539
const decoration = decorations[i]
537540

538-
if (!this.minimap.editorDestroyed()) {
541+
if (!this.destroyed && !this.minimap.editorDestroyed()) {
539542
this.emitDecorationChanges(decoration.getProperties().type, decoration)
540543
}
541544
this.emitter.emit('did-remove-decoration', {

lib/minimap-element.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ class MinimapElement {
456456
destroy () {
457457
this.subscriptions.dispose()
458458
this.DecorationManagement.removeAllDecorations()
459+
this.DecorationManagement.destroyed = true
459460
this.detach()
460461
this.minimap.minimapElement = null
461462
this.minimap = null

0 commit comments

Comments
 (0)