summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.suppress.cppcheck1
-rw-r--r--src/AlsaDriver.cpp5
-rw-r--r--src/Drivers.cpp11
-rw-r--r--src/Drivers.hpp4
-rw-r--r--src/JackLibDriver.cpp5
5 files changed, 15 insertions, 11 deletions
diff --git a/.suppress.cppcheck b/.suppress.cppcheck
index ec887b7..14e7b23 100644
--- a/.suppress.cppcheck
+++ b/.suppress.cppcheck
@@ -3,4 +3,3 @@ constVariablePointer
missingReturn
normalCheckLevelMaxBranches
shadowFunction
-virtualCallInConstructor
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp
index 7671402..20f86f6 100644
--- a/src/AlsaDriver.cpp
+++ b/src/AlsaDriver.cpp
@@ -133,10 +133,7 @@ AlsaDriver::AlsaDriver(ILog& log, EventSink emit_event)
, _log(log)
{}
-AlsaDriver::~AlsaDriver()
-{
- detach();
-}
+AlsaDriver::~AlsaDriver() = default;
void
AlsaDriver::attach(bool /*launch_daemon*/)
diff --git a/src/Drivers.cpp b/src/Drivers.cpp
index 94efd14..7104b00 100644
--- a/src/Drivers.cpp
+++ b/src/Drivers.cpp
@@ -27,6 +27,17 @@ Drivers::Drivers(ILog& log, Driver::EventSink emit_event)
})}
{}
+Drivers::~Drivers()
+{
+ if (_alsa_driver) {
+ _alsa_driver->detach();
+ }
+
+ if (_jack_driver) {
+ _jack_driver->detach();
+ }
+}
+
void
Drivers::refresh()
{
diff --git a/src/Drivers.hpp b/src/Drivers.hpp
index 6bb9eb4..a281d2e 100644
--- a/src/Drivers.hpp
+++ b/src/Drivers.hpp
@@ -4,13 +4,13 @@
#ifndef PATCHAGE_DRIVERS_HPP
#define PATCHAGE_DRIVERS_HPP
-#include "AudioDriver.hpp"
#include "Driver.hpp"
#include <memory>
namespace patchage {
+class AudioDriver;
class ILog;
enum class ClientType;
@@ -26,7 +26,7 @@ public:
Drivers(Drivers&&) = delete;
Drivers& operator=(Drivers&&) = delete;
- ~Drivers() = default;
+ ~Drivers();
/// Refresh all drivers and emit results to the event sink
void refresh();
diff --git a/src/JackLibDriver.cpp b/src/JackLibDriver.cpp
index 6df5b02..b540347 100644
--- a/src/JackLibDriver.cpp
+++ b/src/JackLibDriver.cpp
@@ -104,10 +104,7 @@ JackLibDriver::JackLibDriver(ILog& log, EventSink emit_event)
, _log{log}
{}
-JackLibDriver::~JackLibDriver()
-{
- detach();
-}
+JackLibDriver::~JackLibDriver() = default;
void
JackLibDriver::attach(const bool launch_daemon)