Skip to content
Snippets Groups Projects
Commit 5b705225 authored by Lorenz Meier's avatar Lorenz Meier
Browse files

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.
parent 66b9ee2d
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment