mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Make sure semaphore in MessageProvider is released in case of an error
Patch provided by teslacoil
This commit is contained in:
parent
3171ee969f
commit
57e55734c4
@ -840,12 +840,19 @@ public class MessageProvider extends ContentProvider {
|
||||
String sortOrder) throws Exception {
|
||||
mSemaphore.acquire();
|
||||
|
||||
final Cursor cursor;
|
||||
cursor = mDelegate.query(uri, projection, selection, selectionArgs, sortOrder);
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = mDelegate.query(uri, projection, selection, selectionArgs, sortOrder);
|
||||
} finally {
|
||||
if (cursor == null) {
|
||||
mSemaphore.release();
|
||||
}
|
||||
}
|
||||
|
||||
/* Android content resolvers can only process CrossProcessCursor instances */
|
||||
if (!(cursor instanceof CrossProcessCursor)) {
|
||||
Log.w(K9.LOG_TAG, "Unsupported cursor, returning null: " + cursor);
|
||||
mSemaphore.release();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user