diff options
author | 2011-11-07 15:01:37 -0800 | |
---|---|---|
committer | 2011-11-07 15:01:37 -0800 | |
commit | 0a75373f4187d2db036757c2c2bcaba42301fd22 (patch) | |
tree | 31f621fe5229cc32f5fe38b24d88a48cb742b730 /java | |
parent | f47e014eb251ed83c9672b928b45d7340b83c464 (diff) | |
parent | 8b9c89aee214f692ca4a639ffd96101c60424986 (diff) | |
download | latinime-0a75373f4187d2db036757c2c2bcaba42301fd22.tar.gz latinime-0a75373f4187d2db036757c2c2bcaba42301fd22.tar.xz latinime-0a75373f4187d2db036757c2c2bcaba42301fd22.zip |
Merge "Fix a bug where the UserDictionary may not be released" into ics-mr1
Diffstat (limited to 'java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/UserDictionary.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/UserDictionary.java b/java/src/com/android/inputmethod/latin/UserDictionary.java index 67da4fa50..0bbbf3995 100644 --- a/java/src/com/android/inputmethod/latin/UserDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserDictionary.java @@ -179,8 +179,9 @@ public class UserDictionary extends ExpandableDictionary { new Thread("addWord") { @Override public void run() { + Cursor cursor = null; try { - final Cursor cursor = client.query(Words.CONTENT_URI, PROJECTION_ADD, + cursor = client.query(Words.CONTENT_URI, PROJECTION_ADD, "word=? and ((locale IS NULL) or (locale=?))", new String[] { word, mLocale }, null); if (cursor != null && cursor.moveToFirst()) { @@ -201,6 +202,9 @@ public class UserDictionary extends ExpandableDictionary { // If we come here, the activity is already about to be killed, and we // have no means of contacting the content provider any more. // See ContentResolver#insert, inside the catch(){} + } finally { + if (null != cursor) cursor.close(); + client.release(); } } }.start(); |