diff options
author | Jörg Müller <nexyon@gmail.com> | 2013-11-20 03:20:51 +0400 |
---|---|---|
committer | Jörg Müller <nexyon@gmail.com> | 2013-11-20 03:26:15 +0400 |
commit | 447d2774989cd2df249e1d48cf44ef7e1a109a36 (patch) | |
tree | 657ec3b08336f99c24041e2d0f0c6d3f0b8d4fba /intern | |
parent | 5edf6fc19d3e288e8f0d7227be6da5897d6c8bda (diff) |
Fix IRC reported by elubie: windows crash with audio animation
There was a bug in how the iterators of STL list was used when erasing during iteration of a list, which was triggered by the STL implementation of MSVC, but hid well with gcc.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/audaspace/intern/AUD_AnimateableProperty.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/intern/audaspace/intern/AUD_AnimateableProperty.cpp b/intern/audaspace/intern/AUD_AnimateableProperty.cpp index 6d1a307d868..61adae4b34b 100644 --- a/intern/audaspace/intern/AUD_AnimateableProperty.cpp +++ b/intern/audaspace/intern/AUD_AnimateableProperty.cpp @@ -112,8 +112,12 @@ void AUD_AnimateableProperty::write(const float* data, int position, int count) // otherwise it's not at the end, let's check if some unknown part got filled else { - for(std::list<Unknown>::iterator it = m_unknown.begin(); it != m_unknown.end(); it++) + bool erased = false; + + for(std::list<Unknown>::iterator it = m_unknown.begin(); it != m_unknown.end(); erased ? it : it++) { + erased = false; + // unknown area before position if(it->end < position) continue; @@ -130,9 +134,8 @@ void AUD_AnimateableProperty::write(const float* data, int position, int count) if(position + count > it->end) { // simply delete - std::list<Unknown>::iterator it2 = it; - it++; - m_unknown.erase(it2); + it = m_unknown.erase(it); + erased = true; } // the end is excluded, a second part remains else |