From b40bd344c76ba55f97b66c4b59b0d8d126bb13c0 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Wed, 25 May 2016 13:02:36 +0300 Subject: [PATCH] fixing memory leak --- .../refactoring/lang/ExtractIncludeFileBase.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/refactoring/lang/ExtractIncludeFileBase.java b/platform/lang-impl/src/com/intellij/refactoring/lang/ExtractIncludeFileBase.java index ebe4495b9268..ea96f42cb9e7 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/lang/ExtractIncludeFileBase.java +++ b/platform/lang-impl/src/com/intellij/refactoring/lang/ExtractIncludeFileBase.java @@ -51,6 +51,7 @@ import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.TestOnly; import java.util.ArrayList; import java.util.List; @@ -180,7 +181,16 @@ public abstract class ExtractIncludeFileBase implements Re @Override public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file, DataContext dataContext) { - myIncludingFile = file; + try { + myIncludingFile = file; + doInvoke(project, editor, file); + } + finally { + myIncludingFile = null; + } + } + + protected void doInvoke(@NotNull Project project, Editor editor, PsiFile file) { if (!editor.getSelectionModel().hasSelection()) { String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("no.selection")); CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), HELP_ID); @@ -250,6 +260,8 @@ public abstract class ExtractIncludeFileBase implements Re return extractFileType.getDefaultExtension(); } + @Deprecated + @TestOnly public boolean isValidRange(final T firstToExtract, final T lastToExtract) { return verifyChildRange(firstToExtract, lastToExtract); }