Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2009-07-29 12:06:01 +0000
committerDani Megert2009-07-29 12:06:01 +0000
commit779a84870a79652862887aa2e3b9116b00bd49d2 (patch)
tree6ee6811497cd8e2df1f38b3467eecaa6e76d8451
parentf309b387b946d963fa5c4b3c450c20206b3fa976 (diff)
downloadeclipse.platform.text-779a84870a79652862887aa2e3b9116b00bd49d2.tar.gz
eclipse.platform.text-779a84870a79652862887aa2e3b9116b00bd49d2.tar.xz
eclipse.platform.text-779a84870a79652862887aa2e3b9116b00bd49d2.zip
Fixed bug 284342: DefaultUndoManager disconnect/connect sequence can cause NPE's
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java
index bd24a6cefa7..c745a08c2b8 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultUndoManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -786,9 +786,9 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
}
/** Text buffer to collect text which is inserted into the viewer */
- private StringBuffer fTextBuffer= new StringBuffer();
+ private StringBuffer fTextBuffer;
/** Text buffer to collect viewer content which has been replaced */
- private StringBuffer fPreservedTextBuffer= new StringBuffer();
+ private StringBuffer fPreservedTextBuffer;
/** The document modification stamp for undo. */
protected long fPreservedUndoModificationStamp= IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
/** The document modification stamp for redo. */
@@ -1218,6 +1218,8 @@ public class DefaultUndoManager implements IUndoManager, IUndoManagerExtension {
public void connect(ITextViewer textViewer) {
if (!isConnected() && textViewer != null) {
fTextViewer= textViewer;
+ fTextBuffer= new StringBuffer();
+ fPreservedTextBuffer= new StringBuffer();
if (fUndoContext == null)
fUndoContext= new ObjectUndoContext(this);

Back to the top