diff --git a/platform/service-container/src/com/intellij/serviceContainer/containerUtil.kt b/platform/service-container/src/com/intellij/serviceContainer/containerUtil.kt index 4fc1b935eb28..9ec42b002e6f 100644 --- a/platform/service-container/src/com/intellij/serviceContainer/containerUtil.kt +++ b/platform/service-container/src/com/intellij/serviceContainer/containerUtil.kt @@ -1,5 +1,6 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. @file:ApiStatus.Internal + package com.intellij.serviceContainer import com.intellij.ide.plugins.PluginManagerCore @@ -46,7 +47,10 @@ fun throwAlreadyDisposedError(serviceDescription: String, componentManager: Comp */ @ApiStatus.Internal fun wrapAlreadyDisposedError(error: AlreadyDisposedException): RuntimeException { - if (!isUnderIndicatorOrJob()) { + if (Cancellation.isInNonCancelableSection()) { + return error + } + else if (!isUnderIndicatorOrJob()) { return error } else {