mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Avoid sending message on dead thread
PiperOrigin-RevId: 493040714
This commit is contained in:
parent
656b346e6c
commit
72773a862e
1 changed files with 6 additions and 1 deletions
|
|
@ -200,6 +200,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
|
if (released) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
internalHandler
|
internalHandler
|
||||||
.obtainMessage(
|
.obtainMessage(
|
||||||
MSG_END, END_REASON_CANCELLED, /* unused */ 0, /* transformationException */ null)
|
MSG_END, END_REASON_CANCELLED, /* unused */ 0, /* transformationException */ null)
|
||||||
|
|
@ -333,6 +336,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
releaseTransformationException = TransformationException.createForUnexpected(e);
|
releaseTransformationException = TransformationException.createForUnexpected(e);
|
||||||
cancelException = 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) {
|
if (!forCancellation) {
|
||||||
|
|
@ -352,7 +358,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internalHandlerThread.quitSafely();
|
|
||||||
cancellingConditionVariable.open();
|
cancellingConditionVariable.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue