[rdct-tests] fix wrong modality state on closing project sometimes

GitOrigin-RevId: 0bcedf932ed13196756ec35008933d8a26c51f00
This commit is contained in:
Anastasia Katsman
2024-05-03 10:00:45 +00:00
committed by intellij-monorepo-bot
parent b6111a10c7
commit 96068ab7a2
@@ -237,8 +237,10 @@ open class DistributedTestHost(coroutineScope: CoroutineScope) {
// causes problems if not scheduled on ui thread
session.closeProjectIfOpened.setSuspendPreserveClientId { _, _ ->
ProjectManagerEx.getOpenProjects().forEach { waitProjectInitialisedOrDisposed(it) }
ProjectManagerEx.getInstanceEx().closeAndDisposeAllProjects(checkCanClose = false)
withContext(Dispatchers.EDT + ModalityState.any().asContextElement() + NonCancellable) {
ProjectManagerEx.getOpenProjects().forEach { waitProjectInitialisedOrDisposed(it) }
ProjectManagerEx.getInstanceEx().closeAndDisposeAllProjects(checkCanClose = false)
}
}
/**
* Includes closing the project