mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use weak references in smart pointers when in bulk mode
This commit is contained in:
+5
-1
@@ -30,11 +30,13 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.FreeThreadedFileViewProvider;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
class SmartPsiElementPointerImpl<E extends PsiElement> implements SmartPointerEx<E> {
|
||||
private Reference<E> myElement;
|
||||
@@ -91,7 +93,9 @@ class SmartPsiElementPointerImpl<E extends PsiElement> implements SmartPointerEx
|
||||
}
|
||||
|
||||
private void cacheElement(E element) {
|
||||
myElement = element == null ? null : new SoftReference<E>(element);
|
||||
myElement = element == null ? null :
|
||||
((PsiManagerEx)element.getManager()).isBatchFilesProcessingMode() ? new WeakReference<E>(element) :
|
||||
new SoftReference<E>(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user