Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRüdiger Herrmann2016-10-24 21:22:28 +0000
committerAndrey Loskutov2016-11-05 21:46:58 +0000
commit1c1763096e31aaccc4444dc78cbfb3cbc6979d03 (patch)
tree077a77d40020d6f06318325858c42c9518b24480
parentc54a6055d460951ecdbcf51eaba19c346370a783 (diff)
downloadeclipse.platform.text-1c1763096e31aaccc4444dc78cbfb3cbc6979d03.tar.gz
eclipse.platform.text-1c1763096e31aaccc4444dc78cbfb3cbc6979d03.tar.xz
eclipse.platform.text-1c1763096e31aaccc4444dc78cbfb3cbc6979d03.zip
Bug 506427 - Insufficient is-disposed check in LineNumberRulerColumn::redraw
Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de> Change-Id: I0ef8ae88f5612cb0c7302bbe37df9836f5f22d27
-rw-r--r--org.eclipse.jface.text.tests/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jface.text.tests/pom.xml2
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/source/LineNumberRulerColumnTest.java47
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java8
5 files changed, 58 insertions, 3 deletions
diff --git a/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF b/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF
index 3fdcd1f40..9cc062550 100644
--- a/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.jface.text.tests
-Bundle-Version: 3.11.0.qualifier
+Bundle-Version: 3.11.100.qualifier
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
Export-Package:
diff --git a/org.eclipse.jface.text.tests/pom.xml b/org.eclipse.jface.text.tests/pom.xml
index 99b043b60..0e785af23 100644
--- a/org.eclipse.jface.text.tests/pom.xml
+++ b/org.eclipse.jface.text.tests/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.jface</groupId>
<artifactId>org.eclipse.jface.text.tests</artifactId>
- <version>3.11.0-SNAPSHOT</version>
+ <version>3.11.100-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<testSuite>${project.artifactId}</testSuite>
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/source/LineNumberRulerColumnTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/source/LineNumberRulerColumnTest.java
new file mode 100644
index 000000000..c3faa2fc3
--- /dev/null
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/source/LineNumberRulerColumnTest.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Rüdiger Herrmann 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Rüdiger Herrmann - Insufficient is-disposed check in LineNumberRulerColumn::redraw - https://bugs.eclipse.org/bugs/show_bug.cgi?id=506427
+ *******************************************************************************/
+package org.eclipse.jface.text.source;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+
+public class LineNumberRulerColumnTest {
+
+ private Shell fParent;
+
+ @Before
+ public void setUp() {
+ fParent= new Shell();
+ }
+
+ @After
+ public void tearDown() {
+ fParent.dispose();
+ }
+
+ @Test
+ public void testRedrawAfterDispose() {
+ LineNumberRulerColumn lineNumberRulerColumn= new LineNumberRulerColumn();
+ CompositeRuler ruler= new CompositeRuler();
+ ruler.addDecorator(0, lineNumberRulerColumn);
+ SourceViewer sourceViewer= new SourceViewer(fParent, ruler, SWT.NONE);
+ lineNumberRulerColumn.getControl().setSize(10, 10);
+
+ sourceViewer.getTextWidget().dispose();
+
+ lineNumberRulerColumn.redraw();
+ }
+
+}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
index b8a47db32..35febd98f 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
@@ -14,6 +14,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
+import org.eclipse.jface.text.source.LineNumberRulerColumnTest;
import org.eclipse.jface.text.tests.reconciler.AbstractReconcilerTest;
import org.eclipse.jface.text.tests.rules.DefaultPartitionerTest;
import org.eclipse.jface.text.tests.rules.DefaultPartitionerZeroLengthTest;
@@ -29,6 +30,7 @@ import org.eclipse.jface.text.tests.rules.WordRuleTest;
*/
@RunWith(Suite.class)
@SuiteClasses({
+ LineNumberRulerColumnTest.class,
HTML2TextReaderTest.class,
TextHoverPopupTest.class,
TextPresentationTest.class,
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java
index 384dfc3a7..2d944d157 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java
@@ -10,6 +10,7 @@
* Nikolay Botev <bono8106@hotmail.com> - [rulers] Shift clicking in line number column doesn't select range - https://bugs.eclipse.org/bugs/show_bug.cgi?id=32166
* Nikolay Botev <bono8106@hotmail.com> - [rulers] Clicking in line number ruler should not trigger annotation ruler - https://bugs.eclipse.org/bugs/show_bug.cgi?id=40889
* Florian Weßling <flo@cdhq.de> - [rulers] Line numbering was wrong when word wrap was active - https://bugs.eclipse.org/bugs/show_bug.cgi?id=35779
+ * Rüdiger Herrmann - Insufficient is-disposed check in LineNumberRulerColumn::redraw - https://bugs.eclipse.org/bugs/show_bug.cgi?id=506427
*******************************************************************************/
package org.eclipse.jface.text.source;
@@ -872,7 +873,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
return;
}
- if (fCachedTextViewer != null && fCanvas != null && !fCanvas.isDisposed()) {
+ if (!isDisposed()) {
if (VerticalRuler.AVOID_NEW_GC) {
fCanvas.redraw();
fCanvas.update();
@@ -884,6 +885,11 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn {
}
}
+ private boolean isDisposed() {
+ return fCachedTextViewer == null || fCanvas == null || fCanvas.isDisposed()
+ || fCachedTextViewer.getTextWidget() == null;
+ }
+
@Override
public void setModel(IAnnotationModel model) {
}

Back to the top