diff options
| author | Valentin Kravtsov <valentink@google.com> | 2011-02-18 12:57:59 +0000 |
|---|---|---|
| committer | Valentin Kravtsov <valentink@google.com> | 2011-03-02 10:16:28 +0000 |
| commit | 483701eb9f36a322ca7fa6cad76fa849a756810a (patch) | |
| tree | 7170aa1bced358bff3010f43f81af6738c660c24 /docs/html/sdk/api_diff/5 | |
| parent | dbe09da6ac4d1e9e78e5c8f33fbc6d32822ba7ed (diff) | |
Fixing a race condition in RecognitionService
Bug #3458256
If an error occurs and simultaneously user cancels the recognition, here is what happens:
1. dispatchCancel() is called since the user requested cancel. It passes the first "if" successfully.
private void dispatchCancel(IRecognitionListener listener) {
if (mCurrentCallback == null) {
if (DBG) Log.d(TAG, "cancel called with no preceding startListening - ignoring");
} else if (mCurrentCallback.mListener.asBinder() != listener.asBinder()) {
Log.w(TAG, "cancel called by client who did not call startListening - ignoring");
} else { // the correct state
RecognitionService.this.onCancel(mCurrentCallback);
mCurrentCallback = null;
if (DBG) Log.d(TAG, "canceling - setting mCurrentCallback to null");
}
}
2. Error occurs in the app, which sets the mCurrentCallback to null:
public void error(int error) throws RemoteException {
mCurrentCallback = null;
mListener.onError(error);
}
3. the second "if" is reached in dispatchCancel()
4. boom
Change-Id: I54cdcc98b495d820a2caead1709d8dee968c461e
Diffstat (limited to 'docs/html/sdk/api_diff/5')
0 files changed, 0 insertions, 0 deletions
