aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravan Kumar Lakkimsetti2014-07-14 06:43:51 (EDT)
committerLakshmi Shanmugam2014-07-16 03:00:07 (EDT)
commit0ee9dc624242e96310f7ac5bdd1e7905d3b51c32 (patch)
tree1105adf529594d5dd94f17dea4445afb62c2ce03
parent094f4f9254c7bc5c4410ec70c9aa06779ca739b2 (diff)
downloadeclipse.platform.swt-0ee9dc624242e96310f7ac5bdd1e7905d3b51c32.zip
eclipse.platform.swt-0ee9dc624242e96310f7ac5bdd1e7905d3b51c32.tar.gz
eclipse.platform.swt-0ee9dc624242e96310f7ac5bdd1e7905d3b51c32.tar.bz2
Bug 408953 - gtk : Clear text in Text.getTextChars()refs/changes/63/29863/5
Change-Id: I7ac17b9afcc06ceb61e461a92bfdfa42df01e757 Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java12
1 files changed, 9 insertions, 3 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 ba8e9dc..bec57ab 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
@@ -11,6 +11,8 @@
package org.eclipse.swt.widgets;
+import java.util.Arrays;
+
import org.eclipse.swt.*;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.cairo.*;
@@ -706,6 +708,7 @@ char [] deprocessText (char [] text, int start, int end) {
if (start != 0 || end != start + length) {
char [] newText = new char [length];
System.arraycopy(text, 0, newText, 0, length);
+ Arrays.fill (text, (char) 0);
return newText;
}
return text;
@@ -1315,10 +1318,13 @@ public char [] getTextChars () {
byte [] buffer = new byte [length];
OS.memmove (buffer, address, length);
if ((style & SWT.MULTI) != 0) OS.g_free (address);
+
+ char [] result = Converter.mbcsToWcs (null, buffer);
+ Arrays.fill (buffer, (byte) 0);
if (segments != null) {
- return deprocessText (Converter.mbcsToWcs (null, buffer), 0, -1);
- }
- return Converter.mbcsToWcs (null, buffer);
+ result = deprocessText (result, 0, -1);
+ }
+ return result;
}
/**