aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2014-04-07 10:56:38 (EDT)
committerArun Thondapu2014-04-23 08:38:56 (EDT)
commit3ba953253ba73752e9748cc5e2ecc0fd8c1b5405 (patch)
tree66d386aeb26e79eaaf03a254ff769bd4ba54614a
parentd83903231fe69e4f29ae96f25e052b8e7ef5da5c (diff)
downloadeclipse.platform.swt-3ba953253ba73752e9748cc5e2ecc0fd8c1b5405.zip
eclipse.platform.swt-3ba953253ba73752e9748cc5e2ecc0fd8c1b5405.tar.gz
eclipse.platform.swt-3ba953253ba73752e9748cc5e2ecc0fd8c1b5405.tar.bz2
Bug 414156 - NullPointerException if text is disposed during Modifyrefs/changes/51/24551/4
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 980eb3d..ba8e9dc 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 5d1ce85..fba9850 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 ();