Fix: Read lock is wrongly used for gutSuggestions.

Bug: 9737865

Change-Id: I017f80b46c5dc48c40f2de7c4d516a042992feb4
main
Keisuke Kuroynagi 2013-07-09 17:38:35 +09:00 committed by Keisuke Kuroyanagi
parent 58b2a6372f
commit cfbb7fbd48
1 changed files with 3 additions and 2 deletions

View File

@ -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<SuggestedWordInfo> 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;