13
0

Ensure that immediate events are not accidentally replaced

All Immediate events have the same action samples, while other
parameters differ. Those events must not be removed by a
call to _remove_event(), particularly not SessionEvent::Overwrite
This commit is contained in:
Robin Gareus 2021-05-12 19:13:06 +02:00
parent dcc0f1cb17
commit 8642f5476d
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -125,6 +125,7 @@ SessionEventManager::remove_event (samplepos_t sample, SessionEvent::Type type)
void void
SessionEventManager::replace_event (SessionEvent::Type type, samplepos_t sample, samplepos_t target) SessionEventManager::replace_event (SessionEvent::Type type, samplepos_t sample, samplepos_t target)
{ {
assert (sample != SessionEvent::Immediate);
SessionEvent* ev = new SessionEvent (type, SessionEvent::Replace, sample, target, 0); SessionEvent* ev = new SessionEvent (type, SessionEvent::Replace, sample, target, 0);
queue_event (ev); queue_event (ev);
} }
@ -297,6 +298,7 @@ SessionEventManager::_remove_event (SessionEvent* ev)
for (i = events.begin(); i != events.end(); ++i) { for (i = events.begin(); i != events.end(); ++i) {
if ((*i)->type == ev->type && (*i)->action_sample == ev->action_sample) { if ((*i)->type == ev->type && (*i)->action_sample == ev->action_sample) {
assert ((*i)->action_sample != SessionEvent::Immediate);
if ((*i) == ev) { if ((*i) == ev) {
ret = true; ret = true;
} }