Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b9c89ae authored by Jean Chalard's avatar Jean Chalard
Browse files

Fix a bug where the UserDictionary may not be released

Bug: 5547357
Change-Id: I521afeaa349c86fb0087cedb70127de6acebec78
parent f8b9e7eb
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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();