Skip to content

Commit

Permalink
Merge pull request #3 from xris1658/master
Browse files Browse the repository at this point in the history
Fix traversing operation; prevent crash on writing parameter changes
  • Loading branch information
ShirasawaSama authored Mar 27, 2023
2 parents 79bccd0 + 21f1aeb commit af4845c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,16 @@ class EIMPluginHost : public juce::JUCEApplication, public juce::AudioPlayHead,

void writeAllParameterChanges() {
auto time = juce::Time::getApproximateMillisecondCounter();
for (auto it = parameterChanges.begin(); it != parameterChanges.end(); it++) {
for (auto it = parameterChanges.begin(); it != parameterChanges.end(); ++it) {
if (it->second.second > time) continue;
writeCerr((char)3);
writeCerr(it->first);
writeCerr(it->second.first);
parameterChanges.erase(it);
}
std::erase_if(parameterChanges, [time](const decltype(parameterChanges)::value_type node)
{
return node.second.second <= time;
});
}

template <typename T> inline void writeToHostBuffer(T var) {
Expand Down

0 comments on commit af4845c

Please sign in to comment.