summaryrefslogtreecommitdiffstats
path: root/chips
diff options
context:
space:
mode:
authorScott Kennedy <skennedy@google.com>2013-03-13 19:25:12 -0700
committerScott Kennedy <skennedy@google.com>2013-03-13 19:29:04 -0700
commite46cb66d4265b6fb8800f9120086151b36011f0f (patch)
tree126f8b6cadf0aca08f03c9e3079e54fed408d36f /chips
parentf1d0416bad440e015c8f09c3827acc19d939d71a (diff)
downloadandroid_frameworks_ex-e46cb66d4265b6fb8800f9120086151b36011f0f.tar.gz
android_frameworks_ex-e46cb66d4265b6fb8800f9120086151b36011f0f.tar.bz2
android_frameworks_ex-e46cb66d4265b6fb8800f9120086151b36011f0f.zip
Always close this cursor
Bug: 8375851 Change-Id: I6aa528091615319722ea7b101bb1cda42c97d122
Diffstat (limited to 'chips')
-rw-r--r--chips/src/com/android/ex/chips/RecipientAlternatesAdapter.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientAlternatesAdapter.java b/chips/src/com/android/ex/chips/RecipientAlternatesAdapter.java
index 465c90e..0693df2 100644
--- a/chips/src/com/android/ex/chips/RecipientAlternatesAdapter.java
+++ b/chips/src/com/android/ex/chips/RecipientAlternatesAdapter.java
@@ -136,10 +136,17 @@ public class RecipientAlternatesAdapter extends CursorAdapter {
final Set<String> matchesNotFound = new HashSet<String>();
if (recipientEntries.size() < addresses.size()) {
final List<DirectorySearchParams> paramsList;
- Cursor directoryCursor = context.getContentResolver().query(DirectoryListQuery.URI,
- DirectoryListQuery.PROJECTION, null, null, null);
- paramsList = BaseRecipientAdapter.setupOtherDirectories(context, directoryCursor,
- account);
+ Cursor directoryCursor = null;
+ try {
+ directoryCursor = context.getContentResolver().query(DirectoryListQuery.URI,
+ DirectoryListQuery.PROJECTION, null, null, null);
+ paramsList = BaseRecipientAdapter.setupOtherDirectories(context, directoryCursor,
+ account);
+ } finally {
+ if (directoryCursor != null) {
+ directoryCursor.close();
+ }
+ }
// Run a directory query for each unmatched recipient.
HashSet<String> unresolvedAddresses = new HashSet<String>();
for (String address : addresses) {