Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2004-11-22 10:01:46 -0500
committerAndre Weinand2004-11-22 10:01:46 -0500
commit39bb3d349fc377fdd0882eee1172957fc5656247 (patch)
treec6ab68bf42ab4b2e49cc0ca8b7e69412901c229c /bundles/org.eclipse.compare/compare
parente9ab09eaa99262e85633f0d0cc0ed9fffda23f5d (diff)
downloadeclipse.platform.team-39bb3d349fc377fdd0882eee1172957fc5656247.tar.gz
eclipse.platform.team-39bb3d349fc377fdd0882eee1172957fc5656247.tar.xz
eclipse.platform.team-39bb3d349fc377fdd0882eee1172957fc5656247.zip
fixed #47786: Possible leak in TextMergeViewer
Diffstat (limited to 'bundles/org.eclipse.compare/compare')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java9
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java12
3 files changed, 23 insertions, 0 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
index ded703e43..950d115ee 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
@@ -853,6 +853,8 @@ public abstract class ContentMergeViewer extends ContentViewer
fHVSashCursor= null;
}
+ CompareViewerPane.clearToolBar(fComposite.getParent());
+
super.handleDispose(event);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index 998246f72..1a460dba1 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -2002,7 +2002,9 @@ public class TextMergeViewer extends ContentMergeViewer {
} else
tp.setDocument(newDoc);
+ tp.rememberDocument(newDoc);
newDoc.addDocumentListener(fDocumentListener);
+ //LeakTester.add(newDoc);
}
} else { // same document but different range
@@ -2051,7 +2053,13 @@ public class TextMergeViewer extends ContentMergeViewer {
private void unsetDocument(MergeSourceViewer tp) {
IDocument oldDoc= tp.getDocument();
+ if (oldDoc == null) {
+ oldDoc= tp.getRememberedDocument();
+// if (oldDoc != null)
+// System.err.println("TextMergeViewer.unsetDocument: would leak");
+ }
if (oldDoc != null) {
+ tp.rememberDocument(null);
// deinstall old positions
if (fPositionUpdater != null)
oldDoc.removePositionUpdater(fPositionUpdater);
@@ -2062,6 +2070,7 @@ public class TextMergeViewer extends ContentMergeViewer {
}
oldDoc.removeDocumentListener(fDocumentListener);
+ //LeakTester.remove(oldDoc);
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
index 707b2f1ef..46b7a4d60 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
@@ -68,6 +68,7 @@ public class MergeSourceViewer extends SourceViewer
private Position fRegion;
private boolean fEnabled= true;
private HashMap fActions= new HashMap();
+ private IDocument fRememberedDocument;
private boolean fAddSaveAction= true;
@@ -84,6 +85,17 @@ public class MergeSourceViewer extends SourceViewer
te.setMenu(menu.createContextMenu(te));
}
+ public void rememberDocument(IDocument doc) {
+// if (doc != null && fRememberedDocument != null) {
+// System.err.println("MergeSourceViewer.rememberDocument: fRememberedDocument != null: shouldn't happen"); //$NON-NLS-1$
+// }
+ fRememberedDocument= doc;
+ }
+
+ public IDocument getRememberedDocument() {
+ return fRememberedDocument;
+ }
+
public void hideSaveAction() {
fAddSaveAction= false;
}

Back to the top