From a6424624feda6f473e49f45f8c4bc32e3523c9e0 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Sat, 8 Jul 2017 01:49:14 -0700 Subject: [PATCH] Add missing virtual destructors Fix warnings emitted by Clang: /home/shade/dev/tigervnc/common/rdr/FdInStream.h:30:9: error: 'rdr::FdInStreamBlockCallback' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor] class FdInStreamBlockCallback { ^ In file included from /home/shade/dev/tigervnc/common/network/TcpSocket.cxx:44: In file included from /home/shade/dev/tigervnc/common/network/TcpSocket.h:31: /home/shade/dev/tigervnc/common/network/Socket.h:82:9: error: 'network::ConnectionFilter' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor] class ConnectionFilter { ^ ..etc --- common/network/Socket.h | 1 + common/rdr/FdInStream.h | 1 + common/rfb/SSecurityPlain.h | 4 ++++ common/rfb/SSecurityVncAuth.h | 2 ++ common/rfb/Timer.h | 2 ++ common/rfb/UserPasswdGetter.h | 2 ++ 6 files changed, 12 insertions(+) diff --git a/common/network/Socket.h b/common/network/Socket.h index 53f957e6..874a59cd 100644 --- a/common/network/Socket.h +++ b/common/network/Socket.h @@ -82,6 +82,7 @@ namespace network { class ConnectionFilter { public: virtual bool verifyConnection(Socket* s) = 0; + virtual ~ConnectionFilter() {} }; class SocketListener { diff --git a/common/rdr/FdInStream.h b/common/rdr/FdInStream.h index 5d9598c8..b4c87653 100644 --- a/common/rdr/FdInStream.h +++ b/common/rdr/FdInStream.h @@ -30,6 +30,7 @@ namespace rdr { class FdInStreamBlockCallback { public: virtual void blockCallback() = 0; + virtual ~FdInStreamBlockCallback() {} }; class FdInStream : public InStream { diff --git a/common/rfb/SSecurityPlain.h b/common/rfb/SSecurityPlain.h index 2c08c24e..4bf42b74 100644 --- a/common/rfb/SSecurityPlain.h +++ b/common/rfb/SSecurityPlain.h @@ -38,6 +38,8 @@ namespace rfb { { return validUser(username) ? validateInternal(sc, username, password) : false; } static StringParameter plainUsers; + virtual ~PasswordValidator() { } + protected: virtual bool validateInternal(SConnection* sc, const char *username, const char *password)=0; static bool validUser(const char* username); @@ -50,6 +52,8 @@ namespace rfb { virtual int getType() const { return secTypePlain; }; virtual const char* getUserName() const { return username.buf; } + virtual ~SSecurityPlain() { } + private: PasswordValidator* valid; unsigned int ulen, plen, state; diff --git a/common/rfb/SSecurityVncAuth.h b/common/rfb/SSecurityVncAuth.h index e9f379ba..a1d17472 100644 --- a/common/rfb/SSecurityVncAuth.h +++ b/common/rfb/SSecurityVncAuth.h @@ -37,6 +37,8 @@ namespace rfb { // getVncAuthPasswd() fills buffer of given password and readOnlyPassword. // If there was no read only password in the file, readOnlyPassword buffer is null. virtual void getVncAuthPasswd(PlainPasswd *password, PlainPasswd *readOnlyPassword)=0; + + virtual ~VncAuthPasswdGetter() { } }; class VncAuthPasswdParameter : public VncAuthPasswdGetter, BinaryParameter { diff --git a/common/rfb/Timer.h b/common/rfb/Timer.h index e295b826..78687d1a 100644 --- a/common/rfb/Timer.h +++ b/common/rfb/Timer.h @@ -49,6 +49,8 @@ namespace rfb { // appropriate interval. // If the handler returns false then the Timer is cancelled. virtual bool handleTimeout(Timer* t) = 0; + + virtual ~Callback() {} }; // checkTimeouts() diff --git a/common/rfb/UserPasswdGetter.h b/common/rfb/UserPasswdGetter.h index 18b0bae3..aa72c1dd 100644 --- a/common/rfb/UserPasswdGetter.h +++ b/common/rfb/UserPasswdGetter.h @@ -25,6 +25,8 @@ namespace rfb { // case no user name will be retrieved. The caller MUST delete [] the // result(s). virtual void getUserPasswd(char** user, char** password)=0; + + virtual ~UserPasswdGetter() {} }; } #endif -- 2.39.5