From ed7ea1eb71d1cc4f68e31cd4815c6cbc04fd7818 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 9 Feb 2010 19:08:35 +0000 Subject: Fix bugs with child blocking events. e.g. CreatePortEvent as a child of SetMetadataEvent would doubly unblock the EventSource, so future blocking events wouldn't actually block and crash bugs and/or patch corruption could result. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2435 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/events/SetMetadata.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/engine/events/SetMetadata.cpp') diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp index db68b1fb..77b67543 100644 --- a/src/engine/events/SetMetadata.cpp +++ b/src/engine/events/SetMetadata.cpp @@ -101,20 +101,24 @@ SetMetadata::pre_process() bool is_patch = false, is_node = false, is_port = false, is_output = false; PortType data_type(PortType::UNKNOWN); ResourceImpl::type(_properties, is_patch, is_node, is_port, is_output, data_type); + + // Create a separate request without a source so EventSource isn't unblocked twice + SharedPtr sub_request(new Request(NULL, _request->client(), _request->id())); + if (is_patch) { uint32_t poly = 1; iterator p = _properties.find(uris.ingen_polyphony); if (p != _properties.end() && p->second.is_valid() && p->second.type() == Atom::INT) poly = p->second.get_int32(); - _create_event = new CreatePatch(_engine, _request, _time, + _create_event = new CreatePatch(_engine, sub_request, _time, path, poly, _properties); } else if (is_node) { const iterator p = _properties.find(uris.rdf_instanceOf); - _create_event = new CreateNode(_engine, _request, _time, + _create_event = new CreateNode(_engine, sub_request, _time, path, p->second.get_uri(), true, _properties); } else if (is_port) { - _blocking = true; - _create_event = new CreatePort(_engine, _request, _time, + _blocking = bool(_request); + _create_event = new CreatePort(_engine, sub_request, _time, path, data_type.uri(), is_output, _properties); } if (_create_event) @@ -221,7 +225,7 @@ SetMetadata::execute(ProcessContext& context) if (_create_event) { QueuedEvent::execute(context); _create_event->execute(context); - if (_blocking && _request) + if (_blocking) _request->unblock(); return; } -- cgit v1.2.1