From 0edeef648f479a2e23630c0bab3fc0aec9a5012d Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Thu, 27 Dec 2012 19:10:05 +0000 Subject: [PATCH] Fix -Wdelete-non-virtual-dtor warnings Base classes should have virtual destructors to ensure derived classes destructor is also virtual. This is not a major issue, since in all of the warning cases there is no base destructor, but its nice to shutup the compiler warnings. --- src/Device.h | 1 + src/ProtocolHandler.h | 2 +- src/RideFileCommand.h | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Device.h b/src/Device.h index 6b8b29889..04a765ddd 100644 --- a/src/Device.h +++ b/src/Device.h @@ -85,6 +85,7 @@ typedef QSharedPointer DevicesPtr; struct Devices { + virtual ~Devices() {} virtual DevicePtr newDevice( CommPortPtr, Device::StatusCallback ) = 0; // port *might* be supported by this device type implementation: diff --git a/src/ProtocolHandler.h b/src/ProtocolHandler.h index 9a0b35180..6e266d05e 100644 --- a/src/ProtocolHandler.h +++ b/src/ProtocolHandler.h @@ -29,7 +29,7 @@ class ProtocolMessage { public: ProtocolMessage() { } - ~ProtocolMessage() { } + virtual ~ProtocolMessage() { } enum { HELLO, HELLOFAIL, HELLOSUCCEED, CLIENTLIST, CLIENT, TELEMETRY, diff --git a/src/RideFileCommand.h b/src/RideFileCommand.h index 856f34b46..c3c40fe9d 100644 --- a/src/RideFileCommand.h +++ b/src/RideFileCommand.h @@ -46,7 +46,7 @@ class RideFileCommand : public QObject public: RideFileCommand(RideFile *ride); - ~RideFileCommand(); + virtual ~RideFileCommand(); void setPointValue(int index, RideFile::SeriesType series, double value); void deletePoint(int index); @@ -97,7 +97,9 @@ class RideCommand enum commandtype { NoOp, LUW, SetPointValue, DeletePoint, DeletePoints, InsertPoint, AppendPoints, SetDataPresent }; typedef enum commandtype CommandType; + RideCommand(RideFile *ride) : type(NoOp), ride(ride), docount(0) {} + virtual ~RideCommand() {} virtual bool doCommand() { return true; } virtual bool undoCommand() { return true; }