Skip to content
Snippets Groups Projects
Commit 0a75373f authored by Ken Wakasa's avatar Ken Wakasa Committed by Android (Google) Code Review
Browse files

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

parents f47e014e 8b9c89ae
No related branches found
No related tags found
No related merge requests found
...@@ -179,8 +179,9 @@ public class UserDictionary extends ExpandableDictionary { ...@@ -179,8 +179,9 @@ public class UserDictionary extends ExpandableDictionary {
new Thread("addWord") { new Thread("addWord") {
@Override @Override
public void run() { public void run() {
Cursor cursor = null;
try { 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=?))", "word=? and ((locale IS NULL) or (locale=?))",
new String[] { word, mLocale }, null); new String[] { word, mLocale }, null);
if (cursor != null && cursor.moveToFirst()) { if (cursor != null && cursor.moveToFirst()) {
...@@ -201,6 +202,9 @@ public class UserDictionary extends ExpandableDictionary { ...@@ -201,6 +202,9 @@ public class UserDictionary extends ExpandableDictionary {
// If we come here, the activity is already about to be killed, and we // If we come here, the activity is already about to be killed, and we
// have no means of contacting the content provider any more. // have no means of contacting the content provider any more.
// See ContentResolver#insert, inside the catch(){} // See ContentResolver#insert, inside the catch(){}
} finally {
if (null != cursor) cursor.close();
client.release();
} }
} }
}.start(); }.start();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment