mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Avoid sending message on dead thread
PiperOrigin-RevId: 493040714
This commit is contained in:
parent
900e86ffc8
commit
7ea74444f3
1 changed files with 6 additions and 1 deletions
|
|
@ -200,6 +200,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||
}
|
||||
|
||||
public void cancel() {
|
||||
if (released) {
|
||||
return;
|
||||
}
|
||||
internalHandler
|
||||
.obtainMessage(
|
||||
MSG_END, END_REASON_CANCELLED, /* unused */ 0, /* transformationException */ null)
|
||||
|
|
@ -333,6 +336,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||
releaseTransformationException = TransformationException.createForUnexpected(e);
|
||||
cancelException = e;
|
||||
}
|
||||
// Quit thread lazily so that all events that got triggered when releasing the AssetLoader are
|
||||
// still delivered.
|
||||
internalHandler.post(internalHandlerThread::quitSafely);
|
||||
}
|
||||
|
||||
if (!forCancellation) {
|
||||
|
|
@ -352,7 +358,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||
}
|
||||
}
|
||||
|
||||
internalHandlerThread.quitSafely();
|
||||
cancellingConditionVariable.open();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue