diff options
author | David Robillard <d@drobilla.net> | 2008-12-22 04:42:37 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-12-22 04:42:37 +0000 |
commit | cdccf89368fe6851ed74a651baf1cfcbaaccfb07 (patch) | |
tree | 5b6b0515143bd33b1c1269aafa17eb154551527a /src | |
parent | c349af8e91937111579de7b5fc1e9e2b4807a7c9 (diff) | |
download | ingen-cdccf89368fe6851ed74a651baf1cfcbaaccfb07.tar.gz ingen-cdccf89368fe6851ed74a651baf1cfcbaaccfb07.tar.bz2 ingen-cdccf89368fe6851ed74a651baf1cfcbaaccfb07.zip |
Fix crash when deleting ports that send lots of broadcast events (e.g. a control rate LFO).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1904 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/PostProcessor.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/engine/PostProcessor.cpp b/src/engine/PostProcessor.cpp index 9543a712..b90f7ddc 100644 --- a/src/engine/PostProcessor.cpp +++ b/src/engine/PostProcessor.cpp @@ -46,14 +46,25 @@ PostProcessor::process() { const FrameTime end_time = _max_time.get(); - /* Note the normal (pre-processed client originated) events must - * be sent first, since they could have e.g. created a port which - * is by now inserted, running, and may broadcast something to - * the client. If the broadcast happened first the client would - * not yet know about the port's existance. */ + /* FIXME: The order here is a bit tricky: if the normal events are + * processed first, then a deleted port may still have a pending + * broadcast event which will segfault if executed afterwards. + * If it's the other way around, broadcasts will be sent for + * ports the client doesn't even know about yet... */ /* FIXME: process events from all threads if parallel */ + /* Process audio thread generated events */ + while (_engine.audio_driver()->context().event_sink().read( + _event_buffer_size, _event_buffer)) { + if (((Event*)_event_buffer)->time() > end_time) { + cerr << "WARNING: Lost event with time " + << ((Event*)_event_buffer)->time() << " > " << end_time << endl; + break; + } + ((Event*)_event_buffer)->post_process(); + } + /* Process normal events */ Raul::List<Event*>::Node* n = _events.head(); while (n) { @@ -66,18 +77,6 @@ PostProcessor::process() delete n; n = next; } - - /* Process audio thread generated events */ - while (_engine.audio_driver()->context().event_sink().read( - _event_buffer_size, _event_buffer)) { - if (((Event*)_event_buffer)->time() > end_time) { - cerr << "WARNING: Lost event with time " - << ((Event*)_event_buffer)->time() << " > " << end_time << endl; - break; - } - ((Event*)_event_buffer)->post_process(); - } - } |