Do not launch new coroutines in invokeOnCompletion()

The scope might has been cancelled
This commit is contained in:
FooIbar authored and tarsin committed 2023-02-21 00:31:05 +08:00
1 parent 6b0f8bc325
commit eb95026a47
1 file changed
+1 -3
@@ -573,9 +573,7 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
invokeOnCompletion {
if (getPageState(index) == STATE_DOWNLOADING) {
Log.d(WORKER_DEBUG_TAG, "Download image cancelled $index")
launchNonCancellable {
mSpiderDen.remove(index)
}
mSpiderDen.remove(index)
}
}
}