Avoid collecting events from other projects in PerModulePackageCacheService (KT-33802)
It looks like VFS_CHANGES subscription ignores project boundaries so all events are processed by every listener. If event has a hard reference to project in the requestor field, it might leak through the collection of pending events. An attempt to fix holding test projects through pending events. #KT-33802 Fixed
This commit is contained in:
+7
@@ -71,6 +71,13 @@ class KotlinPackageContentModificationListener(private val project: Project): Di
|
|||||||
val vFile = it.file!!
|
val vFile = it.file!!
|
||||||
vFile.isDirectory || FileTypeRegistry.getInstance().getFileTypeByFileName(vFile.nameSequence) == KotlinFileType.INSTANCE
|
vFile.isDirectory || FileTypeRegistry.getInstance().getFileTypeByFileName(vFile.nameSequence) == KotlinFileType.INSTANCE
|
||||||
}
|
}
|
||||||
|
.filter {
|
||||||
|
when (val origin = it.requestor) {
|
||||||
|
is Project -> origin == project
|
||||||
|
is PsiManager -> origin.project == project
|
||||||
|
else -> true
|
||||||
|
}
|
||||||
|
}
|
||||||
.forEach { event -> service.notifyPackageChange(event) }
|
.forEach { event -> service.notifyPackageChange(event) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user