Skip to content

Commit f742735

Browse files
committed
fix(lint): read access needed in LintContext
1 parent 8e2040f commit f742735

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
### Fixed
1515
- NPE when opening a folder as project.
16+
- Access is allowed only from Event Dispatch Thread in `LintContext`.
1617

1718
## [1.11.1] - 2023-05-08
1819

src/main/kotlin/com/github/blarc/gitlab/template/lint/plugin/pipeline/middleware/LintContext.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.github.blarc.gitlab.template.lint.plugin.pipeline.Pass
77
import com.github.blarc.gitlab.template.lint.plugin.providers.EditorWithMergedPreview
88
import com.github.blarc.gitlab.template.lint.plugin.settings.ProjectSettings
99
import com.github.blarc.gitlab.template.lint.plugin.widget.LintStatusEnum
10+
import com.intellij.openapi.application.runReadAction
1011
import com.intellij.openapi.command.WriteCommandAction
1112
import com.intellij.openapi.components.Service
1213
import com.intellij.openapi.components.service
@@ -82,13 +83,16 @@ class LintContext : Middleware {
8283
remoteId: Long,
8384
branch: String
8485
): GitlabLintResponse? {
85-
return gitlab.lintContent(
86-
gitlabUrl,
87-
gitlabToken,
88-
pass.file.text,
89-
remoteId,
90-
branch,
91-
showGitlabTokenNotification
92-
).get()
86+
87+
return runReadAction {
88+
return@runReadAction gitlab.lintContent(
89+
gitlabUrl,
90+
gitlabToken,
91+
pass.file.text,
92+
remoteId,
93+
branch,
94+
showGitlabTokenNotification
95+
).get()
96+
}
9397
}
9498
}

0 commit comments

Comments
 (0)