diff --git a/platform/service-container/src/com/intellij/serviceContainer/ComponentManagerImpl.kt b/platform/service-container/src/com/intellij/serviceContainer/ComponentManagerImpl.kt index 7d38bf4f1161..81e36304103e 100644 --- a/platform/service-container/src/com/intellij/serviceContainer/ComponentManagerImpl.kt +++ b/platform/service-container/src/com/intellij/serviceContainer/ComponentManagerImpl.kt @@ -1185,6 +1185,7 @@ abstract class ComponentManagerImpl( if (!containerState.compareAndSet(ContainerState.DISPOSED, ContainerState.DISPOSE_COMPLETED)) { throw IllegalStateException("Expected current state is DISPOSED, but actual state is ${containerState.get()} ($this)") } + pluginServicesStore.clearPotentialLeaks() } override fun stopServicePreloading() { @@ -1421,6 +1422,11 @@ private class PluginServicesStore { fun removeDynamicServices(descriptor: IdeaPluginDescriptor): List { return dynamicServices.remove(descriptor)?.toList() ?: java.util.List.of() } + + fun clearPotentialLeaks() { + dynamicServices.clear() + regularServices.clear() + } } private fun createPluginExceptionIfNeeded(error: Throwable, pluginId: PluginId): RuntimeException {