Mixer: Make reset operation more robust

This change makes the operation more robust as it flags the whole group invalid in the first step. This should not be confused with being thread-safe - to be thread-safe, all accesses to _first and the following linked list need to be guarded by a mutex. This should be done outside of the mixer in the driver though, as the method depends on the board architecture.
This commit is contained in:
Lorenz Meier 2016-12-26 12:55:18 +01:00
parent 66b9ee2d24
commit 5b70522541
1 changed files with 7 additions and 3 deletions

View File

@ -88,11 +88,15 @@ void
MixerGroup::reset()
{
Mixer *mixer;
Mixer *next = _first;
/* flag mixer as invalid */
_first = nullptr;
/* discard sub-mixers */
while (_first != nullptr) {
mixer = _first;
_first = mixer->_next;
while (next != nullptr) {
mixer = next;
next = mixer->_next;
delete mixer;
mixer = nullptr;
}