From cfbb7fbd48125909ed61e58500e56b06afc12709 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroynagi Date: Tue, 9 Jul 2013 17:38:35 +0900 Subject: [PATCH] Fix: Read lock is wrongly used for gutSuggestions. Bug: 9737865 Change-Id: I017f80b46c5dc48c40f2de7c4d516a042992feb4 --- .../inputmethod/latin/ExpandableBinaryDictionary.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index a563c7686..657fc64b4 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -196,7 +196,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { final String prevWord, final ProximityInfo proximityInfo, final boolean blockOffensiveWords) { asyncReloadDictionaryIfRequired(); - if (mLocalDictionaryController.readLock().tryLock()) { + // Write lock because getSuggestions in native updates session status. + if (mLocalDictionaryController.writeLock().tryLock()) { try { final ArrayList inMemDictSuggestion = mDictionaryWriter.getSuggestions(composer, prevWord, proximityInfo, @@ -217,7 +218,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { return inMemDictSuggestion; } } finally { - mLocalDictionaryController.readLock().unlock(); + mLocalDictionaryController.writeLock().unlock(); } } return null;