do not let gc collect calculated values like lazy iterables master
authorGregory.Shrago <gregory.shrago@jetbrains.com>
Fri, 26 Feb 2021 22:08:23 +0000 (01:08 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Fri, 26 Feb 2021 22:08:44 +0000 (22:08 +0000)
"Git Copy Revision" action was often disabled because
`VcsDataKeys.VCS_REVISION_NUMBERS` value was gc before
`update` was called. Weak values were introduced to fight
memory leaks, now we need to find another way for that.

GitOrigin-RevId: eea133e579854e26a9bd1ecc9b77125c5742337f

platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/PreCachedDataContext.java

index e99053fd1a89f1712a604e7951765f8f7b1e4ea6..60701626b89781c595e7548a813abf3d20371618 100644 (file)
@@ -26,6 +26,7 @@ import java.awt.*;
 import java.util.ArrayList;
 import java.util.BitSet;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import static com.intellij.ide.impl.DataManagerImpl.getDataProviderEx;
 import static com.intellij.ide.impl.DataManagerImpl.validateEditor;
@@ -64,7 +65,7 @@ class PreCachedDataContext implements DataContext, UserDataHolder {
         return;
       }
 
-      myCachedData = ContainerUtil.createConcurrentWeakValueMap();
+      myCachedData = new ConcurrentHashMap<>();
 
       preGetAllData(component, myCachedData);