From a7f2500001c53dc5a6de9c2525a75229cc7c6645 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Mon, 6 Feb 2012 18:06:20 +0900 Subject: Fix a bug with common objects. Bug: 5961179 Change-Id: I452efc552c6ab390931f25557d7aee5a64bf054e --- java/src/com/android/inputmethod/latin/WordComposer.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java') diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index dd24432f7..f418968b5 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -310,13 +310,18 @@ public class WordComposer { // LastComposedWord#didAutoCorrectToAnotherWord with #equals(). It would be marginally // cleaner to do it here, but it would be slower (since we would #equals() for each commit, // instead of only on cancel), and ultimately we want to figure it out even earlier anyway. - final LastComposedWord lastComposedWord = new LastComposedWord(mCodes, - mXCoordinates, mYCoordinates, mTypedWord.toString(), + final ArrayList codes = mCodes; + final int[] xCoordinates = mXCoordinates; + final int[] yCoordinates = mYCoordinates; + mCodes = new ArrayList(N); + mXCoordinates = new int[N]; + mYCoordinates = new int[N]; + final LastComposedWord lastComposedWord = new LastComposedWord(codes, + xCoordinates, yCoordinates, mTypedWord.toString(), null == mAutoCorrection ? null : mAutoCorrection.toString()); if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD) { lastComposedWord.deactivate(); } - mCodes.clear(); mTypedWord.setLength(0); mAutoCorrection = null; return lastComposedWord; -- cgit v1.2.3-83-g751a