From 7859da2568147cc06ea70992a1baed2ceaae619a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 8 Dec 2019 21:11:49 +0100 Subject: Fix use of virtual functions in destructors --- src/server/BlockImpl.cpp | 6 ++---- src/server/DuplexPort.cpp | 4 ++-- src/server/DuplexPort.hpp | 2 +- src/server/Engine.cpp | 4 ++-- src/server/Engine.hpp | 2 +- src/server/GraphImpl.cpp | 4 ++++ src/server/GraphImpl.hpp | 2 +- src/server/LV2Block.cpp | 4 ++++ src/server/LV2Block.hpp | 2 +- src/server/LV2Plugin.cpp | 2 +- 10 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp index d4d60e5c..ba0bdc77 100644 --- a/src/server/BlockImpl.cpp +++ b/src/server/BlockImpl.cpp @@ -54,12 +54,10 @@ BlockImpl::BlockImpl(PluginImpl* plugin, BlockImpl::~BlockImpl() { - if (_activated) { - deactivate(); - } + assert(!_activated); if (is_linked()) { - parent_graph()->remove_block(*this); + ((GraphImpl*)_parent)->remove_block(*this); } } diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index ffcb711f..8297e3cc 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -74,8 +74,8 @@ DuplexPort::DuplexPort(BufferFactory& bufs, } } - get_buffers(bufs, &BufferFactory::get_buffer, - _voices, parent->polyphony(), 0); + DuplexPort::get_buffers(bufs, &BufferFactory::get_buffer, + _voices, parent->polyphony(), 0); } DuplexPort::~DuplexPort() diff --git a/src/server/DuplexPort.hpp b/src/server/DuplexPort.hpp index 59b3cb51..6b3d0ae6 100644 --- a/src/server/DuplexPort.hpp +++ b/src/server/DuplexPort.hpp @@ -53,7 +53,7 @@ class RunContext; * * \ingroup engine */ -class INGEN_API DuplexPort +class INGEN_API DuplexPort final : public InputPort , public boost::intrusive::slist_base_hook<> // In GraphImpl { diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 9414d8c3..8256981b 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -136,12 +136,12 @@ Engine::Engine(ingen::World& world) Engine::~Engine() { _root_graph = nullptr; - deactivate(); + Engine::deactivate(); // Process all pending events const FrameTime end = std::numeric_limits::max(); RunContext& ctx = run_context(); - locate(ctx.end(), end - ctx.end()); + Engine::locate(ctx.end(), end - ctx.end()); _post_processor->set_end_time(end); _post_processor->process(); while (!_pre_processor->empty()) { diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index 55099f45..45379ad1 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -75,7 +75,7 @@ class Worker; @ingroup engine */ -class INGEN_API Engine : public EngineBase +class INGEN_API Engine final : public EngineBase { public: explicit Engine(ingen::World& world); diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index c0c31b95..00d4cfd6 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -61,6 +61,10 @@ GraphImpl::GraphImpl(Engine& engine, GraphImpl::~GraphImpl() { + if (_activated) { + GraphImpl::deactivate(); + } + delete _plugin; } diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp index a03d3faa..3e3c6159 100644 --- a/src/server/GraphImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -46,7 +46,7 @@ class RunContext; * * \ingroup engine */ -class GraphImpl : public BlockImpl +class GraphImpl final : public BlockImpl { public: GraphImpl(Engine& engine, diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index 17b681f7..124390ff 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -66,6 +66,10 @@ LV2Block::LV2Block(LV2Plugin* plugin, LV2Block::~LV2Block() { + if (_activated) { + LV2Block::deactivate(); + } + // Explicitly drop instances first to prevent reference cycles drop_instances(_instances); drop_instances(_prepared_instances); diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp index 8046189e..9b454b07 100644 --- a/src/server/LV2Block.hpp +++ b/src/server/LV2Block.hpp @@ -47,7 +47,7 @@ class LV2Plugin; * * \ingroup engine */ -class LV2Block : public BlockImpl +class LV2Block final : public BlockImpl { public: LV2Block(LV2Plugin* plugin, diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index fc5705db..01357d8d 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -39,7 +39,7 @@ LV2Plugin::LV2Plugin(World& world, const LilvPlugin* lplugin) { set_property(_uris.rdf_type, _uris.lv2_Plugin); - update_properties(); + LV2Plugin::update_properties(); } void -- cgit v1.2.1