From 8510f80faad7a719a97cf14b1a82a1cc2141282b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 30 Oct 2015 17:02:07 +0000 Subject: Update clients when plugins are unloaded/reloaded git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5808 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/events/Delta.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/server/events/Delta.cpp') diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 9b990c2d..66ebf803 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -160,7 +160,7 @@ get_file_node(LilvWorld* lworld, const URIs& uris, const Atom& value) * a patch:Put ; * patch:subject ; * patch:body [ - * ingen:loadedBundle + * ingen:loadedBundle * ] . * * # Replace /old.lv2 with /new.lv2 @@ -168,10 +168,10 @@ get_file_node(LilvWorld* lworld, const URIs& uris, const Atom& value) * a patch:Patch ; * patch:subject ; * patch:remove [ - * ingen:loadedBundle + * ingen:loadedBundle * ]; * patch:add [ - * ingen:loadedBundle + * ingen:loadedBundle * ] . * @endcode */ @@ -277,7 +277,14 @@ Delta::pre_process() LilvWorld* lworld = _engine.world()->lilv_world(); LilvNode* bundle = get_file_node(lworld, uris, value); if (bundle) { + for (const auto& p : _engine.block_factory()->plugins()) { + if (p.second->bundle_uri() == lilv_node_as_string(bundle)) { + p.second->set_is_zombie(true); + _update.del(p.second->uri()); + } + } lilv_world_unload_bundle(lworld, bundle); + _engine.block_factory()->refresh(); lilv_node_free(bundle); } else { _status = Status::BAD_VALUE; @@ -423,6 +430,14 @@ Delta::pre_process() LilvNode* bundle = get_file_node(lworld, uris, value); if (bundle) { lilv_world_load_bundle(lworld, bundle); + const std::set new_plugins = + _engine.block_factory()->refresh(); + + for (PluginImpl* p : new_plugins) { + if (p->bundle_uri() == lilv_node_as_string(bundle)) { + _update.put_plugin(p); + } + } lilv_node_free(bundle); } else { _status = Status::BAD_VALUE; @@ -568,6 +583,8 @@ Delta::post_process() } if (respond() == Status::SUCCESS) { + _update.send(_engine.broadcaster()); + switch (_type) { case Type::SET: /* Kludge to avoid feedback for set events only. The GUI @@ -583,7 +600,7 @@ Delta::post_process() case Type::PUT: if (_type == Type::PUT && _subject.substr(0, 5) == "file:") { // Preset save - Get::Response response; + ClientUpdate response; response.put(_preset->uri(), _preset->properties()); response.send(_engine.broadcaster()); } else { -- cgit v1.2.1