diff options
author | 2011-11-08 00:39:34 +0000 | |
---|---|---|
committer | 2011-11-08 00:39:34 +0000 | |
commit | 1fefd7a980b4addd9d376153f40f9999cb3dfc9a (patch) | |
tree | ef6e473b219c2c1fd08419de2871d7e9eb0c73a7 /java/src | |
parent | c230b10f84beb203750677578d256dcc2b845c41 (diff) | |
parent | cea3c5bc17f3e9f09c01b7bf79e8060f6d932f63 (diff) | |
download | latinime-1fefd7a980b4addd9d376153f40f9999cb3dfc9a.tar.gz latinime-1fefd7a980b4addd9d376153f40f9999cb3dfc9a.tar.xz latinime-1fefd7a980b4addd9d376153f40f9999cb3dfc9a.zip |
am cea3c5bc: am 0a75373f: Merge "Fix a bug where the UserDictionary may not be released" into ics-mr1
* commit 'cea3c5bc17f3e9f09c01b7bf79e8060f6d932f63':
Fix a bug where the UserDictionary may not be released
Diffstat (limited to 'java/src')
-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(); |