Skip to content

Commit e0b146d

Browse files
committed
fix: ignore inlay events after project disposed
1 parent d7e05c3 commit e0b146d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

marker/src/main/kotlin/spp/jetbrains/marker/plugin/SourceInlayHintProvider.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ abstract class SourceInlayHintProvider : InlayHintsProvider<NoSettings> {
6666
when (event.eventCode) {
6767
VIRTUAL_TEXT_UPDATED, INLAY_MARK_VISIBLE, INLAY_MARK_HIDDEN -> {
6868
ApplicationManager.getApplication().invokeLater {
69+
if (event.sourceMark.project.isDisposed) {
70+
log.warn("Project is disposed, ignoring event: ${event.eventCode}")
71+
return@invokeLater
72+
}
73+
6974
FileEditorManager.getInstance(event.sourceMark.project).selectedTextEditor?.inlayModel
7075
//todo: smaller range
7176
?.getInlineElementsInRange(0, Integer.MAX_VALUE)?.forEach {
@@ -83,8 +88,14 @@ abstract class SourceInlayHintProvider : InlayHintsProvider<NoSettings> {
8388
}
8489
}
8590
}
91+
8692
MARK_REMOVED -> {
8793
ApplicationManager.getApplication().invokeLater {
94+
if (event.sourceMark.project.isDisposed) {
95+
log.warn("Project is disposed, ignoring event: ${event.eventCode}")
96+
return@invokeLater
97+
}
98+
8899
FileEditorManager.getInstance(event.sourceMark.project).selectedTextEditor?.inlayModel
89100
//todo: smaller range
90101
?.getBlockElementsInRange(0, Integer.MAX_VALUE)?.forEach {

0 commit comments

Comments
 (0)