Skip to content

Commit 30ad2d6

Browse files
committed
fix: don't emit if the decoration is already destroyed
1 parent fd61554 commit 30ad2d6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/decoration.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ export default class Decoration {
113113
* @return {Disposable} a disposable to stop listening to the event
114114
*/
115115
onDidChangeProperties(callback) {
116+
if (this.destroyed) {
117+
return
118+
}
116119
return this.emitter.on("did-change-properties", callback)
117120
}
118121

@@ -124,6 +127,9 @@ export default class Decoration {
124127
* @return {Disposable} a disposable to stop listening to the event
125128
*/
126129
onDidDestroy(callback) {
130+
if (this.destroyed) {
131+
return
132+
}
127133
return this.emitter.on("did-destroy", callback)
128134
}
129135

0 commit comments

Comments
 (0)