Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2014-04-07 14:56:38 +0000
committerArun Thondapu2014-04-23 12:38:56 +0000
commit3ba953253ba73752e9748cc5e2ecc0fd8c1b5405 (patch)
tree66d386aeb26e79eaaf03a254ff769bd4ba54614a
parentd83903231fe69e4f29ae96f25e052b8e7ef5da5c (diff)
downloadeclipse.platform.swt-3ba953253ba73752e9748cc5e2ecc0fd8c1b5405.tar.gz
eclipse.platform.swt-3ba953253ba73752e9748cc5e2ecc0fd8c1b5405.tar.xz
eclipse.platform.swt-3ba953253ba73752e9748cc5e2ecc0fd8c1b5405.zip
Bug 414156 - NullPointerException if text is disposed during Modify
event Change-Id: Ic8c214123acf65617c0c3c28d1b2812cf8872392 Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java9
2 files changed, 14 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index 980eb3df6c..ba8e9dc7e3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 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
@@ -415,7 +415,12 @@ public void append (String string) {
}
void applySegments () {
- if (!hooks (SWT.Segments) && !filters (SWT.Segments)) return;
+ /*
+ * It is possible (but unlikely), that application code could have
+ * disposed the widget in the modify event. If this happens, return to
+ * cancel the operation.
+ */
+ if (isDisposed() || (!hooks (SWT.Segments) && !filters (SWT.Segments))) return;
Event event = new Event ();
String string = getText ();
event.text = string;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
index 5d1ce852c9..fba9850ab9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 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
@@ -459,7 +459,12 @@ public void append (String string) {
}
void applySegments () {
- if (--clearSegmentsCount != 0) return;
+ /*
+ * It is possible (but unlikely), that application code could have
+ * disposed the widget in the modify event. If this happens, return to
+ * cancel the operation.
+ */
+ if (isDisposed() || --clearSegmentsCount != 0) return;
if (!hooks (SWT.Segments) && !filters (SWT.Segments)) return;
int length = OS.GetWindowTextLength (handle);
int cp = getCodePage ();

Back to the top