From ed2ce36735754b822e65d5cae8ac7b17ed6938be Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 27 Sep 2015 14:07:04 +0200 Subject: LV2 state cleanup, patch from deva. closes #6607 set _impl->state on session load in order to detect state changes properly (no not save duplicate states). + some small mem-leaks (free state) --- libs/ardour/lv2_plugin.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index cd1c190c38..1c3db86db5 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -480,6 +480,7 @@ LV2Plugin::init(const void* c_plugin, framecnt_t rate) if (state && _has_state_interface) { lilv_state_restore(state, _impl->instance, NULL, NULL, 0, NULL); } + lilv_state_free(state); #endif _sample_rate = rate; @@ -682,6 +683,7 @@ LV2Plugin::~LV2Plugin () cleanup(); lilv_instance_free(_impl->instance); + lilv_state_free(_impl->state); lilv_node_free(_impl->name); lilv_node_free(_impl->author); free(_impl->options); @@ -1696,6 +1698,8 @@ LV2Plugin::set_state(const XMLNode& node, int version) _world.world, _uri_map.urid_map(), NULL, state_file.c_str()); lilv_state_restore(state, _impl->instance, NULL, NULL, 0, NULL); + lilv_state_free(_impl->state); + _impl->state = state; } latency_compute_run(); -- cgit v1.2.3