From 8d93367de7a3d8a288620d8da2a620c6812ee559 Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Sat, 10 Oct 2026 15:48:07 +0200 Subject: [PATCH] fix(sonar): give polymorphic base classes virtual destructors (cpp:S1235) --- McZapkie/friction.h | 1 + McZapkie/hamulce.h | 3 +++ global_include/interfaces/IMaterial.h | 1 + global_include/interfaces/ITexture.h | 1 + network/message.h | 1 + network/network.h | 3 +++ 6 files changed, 10 insertions(+) diff --git a/McZapkie/friction.h b/McZapkie/friction.h index 39679b7c..c58895a9 100644 --- a/McZapkie/friction.h +++ b/McZapkie/friction.h @@ -41,6 +41,7 @@ class TFricMat public: virtual double GetFC(double N, double Vel); + virtual ~TFricMat() = default; }; diff --git a/McZapkie/hamulce.h b/McZapkie/hamulce.h index 9df2b88c..dea32c16 100644 --- a/McZapkie/hamulce.h +++ b/McZapkie/hamulce.h @@ -272,6 +272,7 @@ class TReservoir /// Default constructor — creates a 1 L reservoir at zero pressure. TReservoir() = default; + virtual ~TReservoir() = default; }; /// Pointer typedef for a reservoir instance. @@ -504,6 +505,7 @@ class TBrake { UniversalFlag = flag; } // przycisk uniwersalny + virtual ~TBrake() = default; }; /// @@ -1086,6 +1088,7 @@ class TDriverHandle { memset(Sounds, 0, sizeof(Sounds)); } + virtual ~TDriverHandle() = default; }; /// diff --git a/global_include/interfaces/IMaterial.h b/global_include/interfaces/IMaterial.h index 1cf03592..874e77d0 100644 --- a/global_include/interfaces/IMaterial.h +++ b/global_include/interfaces/IMaterial.h @@ -57,4 +57,5 @@ struct IMaterial } null_material{}; return &null_material; } + virtual ~IMaterial() = default; }; \ No newline at end of file diff --git a/global_include/interfaces/ITexture.h b/global_include/interfaces/ITexture.h index 10e40417..8e4c1955 100644 --- a/global_include/interfaces/ITexture.h +++ b/global_include/interfaces/ITexture.h @@ -73,4 +73,5 @@ struct ITexture } null_texture{}; return &null_texture; } + virtual ~ITexture() = default; }; \ No newline at end of file diff --git a/network/message.h b/network/message.h index 436fd3eb..2424309f 100644 --- a/network/message.h +++ b/network/message.h @@ -21,6 +21,7 @@ struct message message(type_e t) : type(t) {} virtual void serialize(std::ostream &stream) const {} virtual void deserialize(std::istream &stream) {} + virtual ~message() = default; }; struct client_hello : public message diff --git a/network/network.h b/network/network.h index a0dff096..5fcc17df 100644 --- a/network/network.h +++ b/network/network.h @@ -47,6 +47,7 @@ namespace network DEAD }; peer_state state; + virtual ~connection() = default; }; class server @@ -104,6 +105,7 @@ namespace network int get_awaiting_frames() const { return static_cast(delta_queue.size()); } + virtual ~client() = default; }; class backend_manager @@ -112,6 +114,7 @@ namespace network virtual std::shared_ptr create_server(std::shared_ptr, const std::string &conf) = 0; virtual std::shared_ptr create_client(const std::string &conf) = 0; virtual void update() = 0; + virtual ~backend_manager() = default; }; // HACK: static initialization order fiasco fix