mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
IJPL-172200 IJPL-176167 prevent 'LaterInvocator.forceLeaveAllModals'-induced errors from cancelling IDE exit
(cherry picked from commit ee9547bb2963ffcdc7ebb832a7f28621cdcfe82f) IJ-CR-156309 GitOrigin-RevId: 633c237c621400b1a9d48482f859b2931aee38b5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
368142924f
commit
37152190a5
@@ -285,16 +285,18 @@ private class SaveAndSyncHandlerImpl(private val coroutineScope: CoroutineScope)
|
||||
title = getProgressTitle(componentManager),
|
||||
cancellation = TaskCancellation.nonCancellable(),
|
||||
) {
|
||||
// ensure that is fully canceled
|
||||
currentJob?.join()
|
||||
withContext(NonCancellable) {
|
||||
// ensure that is fully canceled
|
||||
currentJob?.join()
|
||||
|
||||
isSavedSuccessfully = saveSettings(componentManager, forceSavingAllSettings = true)
|
||||
isSavedSuccessfully = saveSettings(componentManager, forceSavingAllSettings = true)
|
||||
|
||||
if (project != null && !ApplicationManager.getApplication().isUnitTestMode) {
|
||||
val stateStore = project.stateStore
|
||||
val path = if (stateStore.storageScheme == StorageScheme.DIRECTORY_BASED) stateStore.projectBasePath else stateStore.projectFilePath
|
||||
// update last modified for all project files modified between project open and close
|
||||
ConversionService.getInstance()?.saveConversionResult(path)
|
||||
if (project != null && !ApplicationManager.getApplication().isUnitTestMode) {
|
||||
val stateStore = project.stateStore
|
||||
val path = if (stateStore.storageScheme == StorageScheme.DIRECTORY_BASED) stateStore.projectBasePath else stateStore.projectFilePath
|
||||
// update last modified for all project files modified between project open and close
|
||||
ConversionService.getInstance()?.saveConversionResult(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,8 +674,13 @@ public final class ApplicationImpl extends ClientAwareComponentManager implement
|
||||
stopServicePreloading();
|
||||
|
||||
if (BitUtil.isSet(flags, SAVE)) {
|
||||
TraceKt.use(tracer.spanBuilder("saveSettingsOnExit"),
|
||||
__ -> SaveAndSyncHandler.getInstance().saveSettingsUnderModalProgress(this));
|
||||
try {
|
||||
TraceKt.use(tracer.spanBuilder("saveSettingsOnExit"),
|
||||
__ -> SaveAndSyncHandler.getInstance().saveSettingsUnderModalProgress(this));
|
||||
}
|
||||
catch (Throwable e) {
|
||||
logErrorDuringExit("Failed to save settings", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (isInstantShutdownPossible()) {
|
||||
|
||||
@@ -23,6 +23,8 @@ sealed interface TaskCancellation {
|
||||
companion object {
|
||||
/**
|
||||
* @return a cancellation instance, which means that the cancel button should not be displayed in the UI
|
||||
*
|
||||
* It does not indicate that the task is inside [kotlinx.coroutines.NonCancellable] section.
|
||||
*/
|
||||
@Contract(pure = true)
|
||||
@JvmStatic
|
||||
|
||||
Reference in New Issue
Block a user