Don't trim newer inputpointers with old data

We already have a mechanism to avoid this crash, but it wasn't
used every time it needed to. It's possible that ending a batch
input and starting a batch input happen while suggestions
are being pulled out, which would result in pointers that have
been reset being passed for trimming.
Just increasing the sequence number should get rid of the
problem.

Bug: 12178124
Change-Id: I36ef3bc8a78679bc09daa39e665f5ce1bab50c2a
This commit is contained in:
Jean Chalard 2014-02-21 16:43:11 +09:00
parent 1b3a142cac
commit 2a5ec00301

View file

@ -490,6 +490,7 @@ public final class InputLogic {
handler.showGesturePreviewAndSuggestionStrip( handler.showGesturePreviewAndSuggestionStrip(
SuggestedWords.EMPTY, false /* dismissGestureFloatingPreviewText */); SuggestedWords.EMPTY, false /* dismissGestureFloatingPreviewText */);
handler.cancelUpdateSuggestionStrip(); handler.cancelUpdateSuggestionStrip();
++mAutoCommitSequenceNumber;
mConnection.beginBatchEdit(); mConnection.beginBatchEdit();
if (mWordComposer.isComposingWord()) { if (mWordComposer.isComposingWord()) {
if (settingsValues.mIsInternal) { if (settingsValues.mIsInternal) {
@ -587,6 +588,7 @@ public final class InputLogic {
public void onEndBatchInput(final SettingsValues settingValues, public void onEndBatchInput(final SettingsValues settingValues,
final InputPointers batchPointers) { final InputPointers batchPointers) {
mInputLogicHandler.onEndBatchInput(batchPointers, mAutoCommitSequenceNumber); mInputLogicHandler.onEndBatchInput(batchPointers, mAutoCommitSequenceNumber);
++mAutoCommitSequenceNumber;
} }
// TODO: remove this argument // TODO: remove this argument