mirror of
https://github.com/samsonjs/media.git
synced 2026-04-05 11:15:46 +00:00
Close cursor in DownloadManager.
Not closing the cursor crashes the demo app when in run in StrictMode. PiperOrigin-RevId: 240768493
This commit is contained in:
parent
b1a13f9651
commit
bb48dc9916
1 changed files with 6 additions and 1 deletions
|
|
@ -601,8 +601,9 @@ public final class DownloadManager {
|
|||
fileIOHandler.post(
|
||||
() -> {
|
||||
DownloadState[] loadedStates;
|
||||
DownloadStateCursor cursor = null;
|
||||
try {
|
||||
DownloadStateCursor cursor =
|
||||
cursor =
|
||||
downloadIndex.getDownloadStates(
|
||||
STATE_QUEUED,
|
||||
STATE_STOPPED,
|
||||
|
|
@ -618,6 +619,10 @@ public final class DownloadManager {
|
|||
} catch (Throwable e) {
|
||||
Log.e(TAG, "Download state loading failed.", e);
|
||||
loadedStates = new DownloadState[0];
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
final DownloadState[] states = loadedStates;
|
||||
handler.post(
|
||||
|
|
|
|||
Loading…
Reference in a new issue