Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 426 - send messages to dead thread. #624

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ public void run() {
loadable.load();
TraceUtil.endSection();
}
sendEmptyMessage(MSG_END_OF_SOURCE);
passEmptyMessage(MSG_END_OF_SOURCE);
} catch (IOException e) {
obtainMessage(MSG_IO_EXCEPTION, e).sendToTarget();
} catch (InterruptedException e) {
// The load was canceled.
Assertions.checkState(loadable.isLoadCanceled());
sendEmptyMessage(MSG_END_OF_SOURCE);
passEmptyMessage(MSG_END_OF_SOURCE);
} catch (Exception e) {
// This should never happen, but handle it anyway.
Log.e(TAG, "Unexpected exception loading stream", e);
Expand All @@ -229,7 +229,13 @@ public void run() {
throw e;
}
}


private void passEmptyMessage(int what){
if (getLooper().getThread().getState() != Thread.State.TERMINATED){
sendEmptyMessage(what);
}
}

@Override
public void handleMessage(Message msg) {
if (msg.what == MSG_FATAL_ERROR) {
Expand Down