Skip to content

Commit

Permalink
clion: fix UI call on non-UI thread
Browse files Browse the repository at this point in the history
after 2024.2 CLion invokes createProcess on a background
thread, so UI access is no longer allowed in this context.
fix is backward compatible as we're allowed to use
invokeAndWait on EDT as well.

fixes bazelbuild#6740
  • Loading branch information
ujohnny committed Sep 6, 2024
1 parent b5489fb commit 75464f5
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.xdebugger.XDebugSession;
Expand Down Expand Up @@ -135,26 +136,28 @@ private ProcessHandler createProcess(CommandLineState state, List<String> extraB
Preconditions.checkNotNull(ProjectViewManager.getInstance(project).getProjectViewSet());

if (shouldDisplayBazelTestFilterWarning()) {
String messageContents =
"<html>The Google Test framework did not apply test filtering correctly before "
+ "git commit <a href='https://github.com/google/googletest/commit/"
+ "ba96d0b1161f540656efdaed035b3c062b60e006"
+ "'>ba96d0b<a>.<br/>"
+ "Please ensure you are past this commit if you are using it.<br/><br/>"
+ "More information on the bazel <a href='https://github.com/bazelbuild/bazel/issues/"
+ "4411'>issue</a></html>";

int selectedOption =
Messages.showDialog(
getProject(),
messageContents,
"Please update 'Google Test' past ba96d0b...",
new String[] {"Close", "Don't show again"},
0, // Default to "Close"
Messages.getWarningIcon());
if (selectedOption == 1) {
PropertiesComponent.getInstance().setValue(DISABLE_BAZEL_GOOGLETEST_FILTER_WARNING, "true");
}
ApplicationManager.getApplication().invokeAndWait(() -> {
String messageContents =
"<html>The Google Test framework did not apply test filtering correctly before "
+ "git commit <a href='https://github.com/google/googletest/commit/"
+ "ba96d0b1161f540656efdaed035b3c062b60e006"
+ "'>ba96d0b<a>.<br/>"
+ "Please ensure you are past this commit if you are using it.<br/><br/>"
+ "More information on the bazel <a href='https://github.com/bazelbuild/bazel/issues/"
+ "4411'>issue</a></html>";

int selectedOption =
Messages.showDialog(
getProject(),
messageContents,
"Please update 'Google Test' past ba96d0b...",
new String[] {"Close", "Don't show again"},
0, // Default to "Close"
Messages.getWarningIcon());
if (selectedOption == 1) {
PropertiesComponent.getInstance().setValue(DISABLE_BAZEL_GOOGLETEST_FILTER_WARNING, "true");
}
});
}

BlazeCommand.Builder commandBuilder =
Expand Down

0 comments on commit 75464f5

Please sign in to comment.