Change-Id: I9c3fdce18b604c780e3561c4b6815627e360773d
num_messages++;
}
- print_duration(num_messages, started);
return ECORE_CALLBACK_RENEW;
}
lock.lock();
end = mAudioData.end();
+
+ /* Check if the lead variable is still valid, just in case the mAudioData variable
+ * got cleared by another thread before the lock gets acquired again. */
+ bool is_lead_valid = false;
+ for (auto it = mAudioData.begin();is_lead_valid == false && it != end;++it) {
+ if (lead == it) {
+ is_lead_valid = true;
+ }
+ }
+
vector<IAudioEventObserver*> observers = mObservers;
- if (lead != end) {
+ if (is_lead_valid && lead != end) {
iter = lead;
mas_speech_data speech_data = iter->data;