From ddfb2ec23014733cebf10f18d83ef8238fa4e976 Mon Sep 17 00:00:00 2001 From: Vadim Salavatov Date: Thu, 7 Mar 2024 18:00:04 +0100 Subject: [PATCH] IDEA-340835 don't overwrite recent project info if it's already considered recent GitOrigin-RevId: bc3a6a4531e6475e7e312b317df2b835d2873121 --- .../src/com/intellij/ide/RecentProjectsManagerBase.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.kt b/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.kt index cae4e393bc6e..e7df32007bcf 100644 --- a/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.kt +++ b/platform/platform-impl/src/com/intellij/ide/RecentProjectsManagerBase.kt @@ -261,10 +261,13 @@ open class RecentProjectsManagerBase(coroutineScope: CoroutineScope) : } } + /** + * No-op if [path] is already present in recent projects + */ fun addRecentPath(path: String, info: RecentProjectMetaInfo) { synchronized(stateLock) { - state.additionalInfo.put(path, info) - modCounter.increment() + val presentInfo = state.additionalInfo.putIfAbsent(path, info) + if (presentInfo == null) modCounter.increment() } }