Skip to content

Commit

Permalink
Add virtual destructors to inheritance roots
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmacha committed May 27, 2024
1 parent d8f5f37 commit 0a442cd
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/NH/Bass/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace NH::Bass

struct Command
{

virtual CommandResult Execute(Engine& engine) = 0;
virtual ~Command() = default;
};

class FunctionCommand : public Command
Expand Down
1 change: 1 addition & 0 deletions src/NH/Bass/EventManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace NH::Bass

Event() = delete;
Event(EventType type, DataType data) : Type(type), Data(data) {}
virtual ~Event() = default;
};

using EventSubscriberFn = void (*)(const Event&, void*);
Expand Down
2 changes: 2 additions & 0 deletions src/NH/Bass/IChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ namespace NH::Bass
template<typename T>
using Result = std::expected<T, Error>;

virtual ~IChannel() = default;

virtual Result<void> PlayInstant(const AudioFile& audioFile) = 0;
virtual void StopInstant() = 0;

Expand Down
2 changes: 2 additions & 0 deletions src/NH/Bass/IEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ namespace NH::Bass

struct IEngine
{
virtual ~IEngine() = default;

/**
* Get a free channel and mark it as busy
* @return shared_ptr to a free channel (or null if all channels are busy)
Expand Down
1 change: 1 addition & 0 deletions src/NH/Executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace NH
{
virtual void AddTask(TaskFN&& task) = 0;
virtual void AddTask(const TaskFN& task) = 0;
virtual ~Executor() = default;
};

class InstantExecutor : public Executor
Expand Down
1 change: 1 addition & 0 deletions src/NH/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace NH
LoggerLevel m_Level;

explicit ILoggerAdapter(LoggerLevel level = LoggerLevel::Debug) : m_Level(level) {}
virtual ~ILoggerAdapter() = default;

bool CanLog(LoggerLevel level) const { return level <= m_Level; }

Expand Down

0 comments on commit 0a442cd

Please sign in to comment.