diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/PluginModel.cpp | 16 | ||||
-rw-r--r-- | src/serialisation/Serialiser.cpp | 5 | ||||
-rw-r--r-- | src/server/BufferFactory.cpp | 10 | ||||
-rw-r--r-- | src/server/Engine.cpp | 11 | ||||
-rw-r--r-- | src/server/EngineStore.cpp | 5 | ||||
-rw-r--r-- | src/server/EngineStore.hpp | 18 | ||||
-rw-r--r-- | src/server/JackDriver.cpp | 16 | ||||
-rw-r--r-- | src/server/LV2BlobFeature.hpp | 4 | ||||
-rw-r--r-- | src/server/LV2EventFeature.hpp | 4 | ||||
-rw-r--r-- | src/server/LV2RequestRunFeature.hpp | 2 | ||||
-rw-r--r-- | src/server/events/DisconnectAll.cpp | 5 | ||||
-rw-r--r-- | src/shared/World.cpp | 3 |
12 files changed, 77 insertions, 22 deletions
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 694e5ce0..80b78887 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -238,9 +238,11 @@ PluginModel::documentation() const LilvNodes* vals = lilv_plugin_get_value(_lilv_plugin, rdfs_comment); - const LilvNode* val = lilv_nodes_get_first(vals); - if (lilv_node_is_string(val)) { - doc += lilv_node_as_string(val); + if (vals) { + const LilvNode* val = lilv_nodes_get_first(vals); + if (lilv_node_is_string(val)) { + doc += lilv_node_as_string(val); + } } lilv_node_free(rdfs_comment); lilv_nodes_free(vals); @@ -266,9 +268,11 @@ PluginModel::port_documentation(uint32_t index) const LilvNodes* vals = lilv_port_get_value(_lilv_plugin, port, rdfs_comment); - const LilvNode* val = lilv_nodes_get_first(vals); - if (lilv_node_is_string(val)) { - doc += lilv_node_as_string(val); + if (vals) { + const LilvNode* val = lilv_nodes_get_first(vals); + if (lilv_node_is_string(val)) { + doc += lilv_node_as_string(val); + } } lilv_node_free(rdfs_comment); lilv_nodes_free(vals); diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 4a69d597..22632810 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -124,6 +124,11 @@ Serialiser::Serialiser(Shared::World& world, SharedPtr<Shared::Store> store) : me(new Impl(world, store)) {} +Serialiser::~Serialiser() +{ + delete me; +} + void Serialiser::to_file(SharedPtr<const GraphObject> object, const std::string& filename) diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index f725079b..f6f73fdc 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -44,6 +44,7 @@ BufferFactory::BufferFactory(Engine& engine, BufferFactory::~BufferFactory() { + _silent_buffer.reset(); free_list(_free_audio.get()); free_list(_free_control.get()); free_list(_free_event.get()); @@ -53,10 +54,11 @@ BufferFactory::~BufferFactory() void BufferFactory::free_list(Buffer* head) { - Buffer* next = head->_next; - delete head; - if (next) - free_list(next); + while (head) { + Buffer* next = head->_next; + delete head; + head = next; + } } void diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 3aa05eba..301d90e1 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -57,7 +57,6 @@ bool ThreadManager::single_threaded = true; Engine::Engine(Ingen::Shared::World* a_world) : _world(a_world) , _broadcaster(new ClientBroadcaster()) - , _buffer_factory(new BufferFactory(*this, a_world->uris())) , _control_bindings(new ControlBindings(*this)) , _maid(new Raul::Maid(event_queue_size())) , _message_context(new MessageContext(*this)) @@ -66,9 +65,13 @@ Engine::Engine(Ingen::Shared::World* a_world) , _quit_flag(false) { if (a_world->store()) { - assert(PtrCast<EngineStore>(a_world->store())); + SharedPtr<EngineStore> estore = PtrCast<EngineStore>(a_world->store()); + _buffer_factory = estore->buffer_factory().get(); } else { - a_world->set_store(SharedPtr<Ingen::Shared::Store>(new EngineStore())); + _buffer_factory = new BufferFactory(*this, a_world->uris()); + a_world->set_store( + SharedPtr<Ingen::Shared::Store>( + new EngineStore(SharedPtr<BufferFactory>(_buffer_factory)))); } } @@ -85,6 +88,8 @@ Engine::~Engine() delete _maid; delete _post_processor; delete _node_factory; + delete _message_context; + delete _control_bindings; delete _broadcaster; munlockall(); diff --git a/src/server/EngineStore.cpp b/src/server/EngineStore.cpp index ee0dc933..f47169bc 100644 --- a/src/server/EngineStore.cpp +++ b/src/server/EngineStore.cpp @@ -35,6 +35,11 @@ using namespace Raul; namespace Ingen { namespace Server { +EngineStore::~EngineStore() +{ + clear(); +} + /** Find the Patch at the given path. */ PatchImpl* diff --git a/src/server/EngineStore.hpp b/src/server/EngineStore.hpp index ba8dd000..76a97b9c 100644 --- a/src/server/EngineStore.hpp +++ b/src/server/EngineStore.hpp @@ -28,10 +28,11 @@ class GraphObject; namespace Server { -class PatchImpl; +class BufferFactory; +class GraphObjectImpl; class NodeImpl; +class PatchImpl; class PortImpl; -class GraphObjectImpl; /** Storage for all GraphObjects (tree of GraphObject's sorted by path). * @@ -45,6 +46,11 @@ class GraphObjectImpl; class EngineStore : public Ingen::Shared::Store { public: + EngineStore(SharedPtr<BufferFactory> f) : _factory(f) {} + ~EngineStore(); + + SharedPtr<BufferFactory> buffer_factory() const { return _factory; } + PatchImpl* find_patch(const Raul::Path& path); NodeImpl* find_node(const Raul::Path& path); PortImpl* find_port(const Raul::Path& path); @@ -57,6 +63,14 @@ public: SharedPtr<Objects> remove(Objects::iterator i); SharedPtr<Objects> remove_children(const Raul::Path& path); SharedPtr<Objects> remove_children(Objects::iterator i); + +private: + /* This holds a reference to the BufferFactory since the objects stored + here refer to it, so the BufferFactory may only be deleted after the + EngineStore is emptied and deleted. + */ + + SharedPtr<BufferFactory> _factory; }; } // namespace Server diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index cc258fb3..42e9f78a 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -206,6 +206,8 @@ JackDriver::~JackDriver() if (_client) jack_client_close(_client); + + delete _jack_thread; } bool @@ -322,7 +324,9 @@ JackDriver::deactivate() _client = NULL; } - _jack_thread->stop(); + delete _jack_thread; + _jack_thread = NULL; + LOG(info) << "Deactivated Jack client" << endl; } } @@ -483,11 +487,13 @@ JackDriver::_process_cb(jack_nframes_t nframes) void JackDriver::_thread_init_cb() { - // Initialize thread specific data - _jack_thread = Thread::create_for_this_thread("Jack"); - assert(&Thread::get() == _jack_thread); + if (_jack_thread) { + delete _jack_thread; + } + + _jack_thread = &Thread::get(); + _jack_thread->set_name("Jack"); _jack_thread->set_context(THREAD_PROCESS); - ThreadManager::assert_thread(THREAD_PROCESS); } void diff --git a/src/server/LV2BlobFeature.hpp b/src/server/LV2BlobFeature.hpp index b66a2828..ec7c154d 100644 --- a/src/server/LV2BlobFeature.hpp +++ b/src/server/LV2BlobFeature.hpp @@ -36,6 +36,10 @@ struct BlobFeature : public Ingen::Shared::LV2Features::Feature { _feature.data = data; } + ~BlobFeature() { + free(_feature.data); + } + static LV2_Blob ref_get(LV2_Blob_Support_Data data, LV2_Reference* ref) { return 0; } diff --git a/src/server/LV2EventFeature.hpp b/src/server/LV2EventFeature.hpp index 5e2f1f31..4796c6e1 100644 --- a/src/server/LV2EventFeature.hpp +++ b/src/server/LV2EventFeature.hpp @@ -34,6 +34,10 @@ struct EventFeature : public Ingen::Shared::LV2Features::Feature { _feature.data = data; } + ~EventFeature() { + free(_feature.data); + } + static uint32_t event_ref(LV2_Event_Callback_Data callback_data, LV2_Event* event) { return 0; } diff --git a/src/server/LV2RequestRunFeature.hpp b/src/server/LV2RequestRunFeature.hpp index e1af0aca..a10a0eee 100644 --- a/src/server/LV2RequestRunFeature.hpp +++ b/src/server/LV2RequestRunFeature.hpp @@ -56,7 +56,7 @@ struct RequestRunFeature : public Ingen::Shared::LV2Features::Feature { } static void delete_feature(LV2_Feature* feature) { - delete (Data*)feature->data; + free(feature->data); free(feature); } diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index dd694810..23db5167 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -129,8 +129,11 @@ DisconnectAll::pre_process() } for (Patch::Connections::const_iterator i = _parent->connections().begin(); - i != _parent->connections().end(); ++i) { + i != _parent->connections().end();) { + Patch::Connections::const_iterator next = i; + ++next; maybe_remove_connection((ConnectionImpl*)i->second.get()); + i = next; } if (!_deleting && _parent->enabled()) diff --git a/src/shared/World.cpp b/src/shared/World.cpp index eb60a1a5..e6742c85 100644 --- a/src/shared/World.cpp +++ b/src/shared/World.cpp @@ -130,6 +130,9 @@ public: virtual ~Pimpl() { + serialiser.reset(); + parser.reset(); + local_engine.reset(); modules.clear(); |