leak
authorAlexey Kudravtsev <cdr@intellij.com>
Mon, 16 Aug 2010 10:31:03 +0000 (14:31 +0400)
committerAlexey Kudravtsev <cdr@intellij.com>
Mon, 16 Aug 2010 14:56:55 +0000 (18:56 +0400)
platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionAction.java

index 2786ca96978e88f4223cdda261d00d7e1691fd2e..2960a2c6c3f8afa6b5ee895c4f62228ae51f8b68 100644 (file)
@@ -52,13 +52,17 @@ public class CodeInspectionAction extends BaseAnalysisAction {
   }
 
   protected void analyze(@NotNull Project project, AnalysisScope scope) {
-    FileDocumentManager.getInstance().saveAllDocuments();
-    final InspectionManagerEx inspectionManagerEx = ((InspectionManagerEx)InspectionManager.getInstance(project));
-    final GlobalInspectionContextImpl inspectionContext = getGlobalInspectionContext(project);
-    inspectionContext.setExternalProfile(myExternalProfile);
-    inspectionContext.setCurrentScope(scope);
-    inspectionContext.doInspections(scope, inspectionManagerEx);
-    myGlobalInspectionContext = null;
+    try {
+      FileDocumentManager.getInstance().saveAllDocuments();
+      final InspectionManagerEx inspectionManagerEx = (InspectionManagerEx)InspectionManager.getInstance(project);
+      final GlobalInspectionContextImpl inspectionContext = getGlobalInspectionContext(project);
+      inspectionContext.setExternalProfile(myExternalProfile);
+      inspectionContext.setCurrentScope(scope);
+      inspectionContext.doInspections(scope, inspectionManagerEx);
+    }
+    finally {
+      myGlobalInspectionContext = null;
+    }
   }