mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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(
|
fileIOHandler.post(
|
||||||
() -> {
|
() -> {
|
||||||
DownloadState[] loadedStates;
|
DownloadState[] loadedStates;
|
||||||
|
DownloadStateCursor cursor = null;
|
||||||
try {
|
try {
|
||||||
DownloadStateCursor cursor =
|
cursor =
|
||||||
downloadIndex.getDownloadStates(
|
downloadIndex.getDownloadStates(
|
||||||
STATE_QUEUED,
|
STATE_QUEUED,
|
||||||
STATE_STOPPED,
|
STATE_STOPPED,
|
||||||
|
|
@ -618,6 +619,10 @@ public final class DownloadManager {
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.e(TAG, "Download state loading failed.", e);
|
Log.e(TAG, "Download state loading failed.", e);
|
||||||
loadedStates = new DownloadState[0];
|
loadedStates = new DownloadState[0];
|
||||||
|
} finally {
|
||||||
|
if (cursor != null) {
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
final DownloadState[] states = loadedStates;
|
final DownloadState[] states = loadedStates;
|
||||||
handler.post(
|
handler.post(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue