am 0a75373f: Merge "Fix a bug where the UserDictionary may not be released" into ics-mr1

* commit '0a75373f4187d2db036757c2c2bcaba42301fd22':
  Fix a bug where the UserDictionary may not be released
This commit is contained in:
Ken Wakasa 2011-11-07 23:04:05 +00:00 committed by Android Git Automerger
commit cea3c5bc17

View file

@ -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();