1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(interface): use virtual destructors for all interfaces

Avoids memory leak if derived classes are deleted through interface pointer.

Fix #6006
This commit is contained in:
Anthony Bilinski 2020-03-22 00:39:10 -07:00
parent 205bfa56ca
commit 2b981d88a2
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
11 changed files with 14 additions and 2 deletions

View File

@ -105,6 +105,7 @@ class IAudioControl : public QObject
Q_OBJECT
public:
virtual ~IAudioControl() = default;
virtual qreal outputVolume() const = 0;
virtual void setOutputVolume(qreal volume) = 0;
virtual qreal maxOutputVolume() const = 0;

View File

@ -26,6 +26,8 @@
class IAudioSettings {
public:
virtual ~IAudioSettings() = default;
virtual QString getInDev() const = 0;
virtual void setInDev(const QString& deviceSpecifier) = 0;

View File

@ -97,7 +97,7 @@ public:
return {};
}
virtual ~IAudioSink() {}
virtual ~IAudioSink() = default;
virtual void playAudioBuffer(const int16_t* data, int samples, unsigned channels,
int sampleRate) const = 0;
virtual void playMono16Sound(const Sound& sound) = 0;

View File

@ -34,7 +34,7 @@ class IAudioSource : public QObject
{
Q_OBJECT
public:
virtual ~IAudioSource() {}
virtual ~IAudioSource() = default;
virtual operator bool() const = 0;

View File

@ -35,6 +35,7 @@ public:
ptSOCKS5 = 1,
ptHTTP = 2
};
virtual ~ICoreSettings() = default;
virtual bool getEnableIPv6() const = 0;
virtual void setEnableIPv6(bool enable) = 0;

View File

@ -28,6 +28,7 @@
class IAboutFriend
{
public:
virtual ~IAboutFriend() = default;
virtual QString getName() const = 0;
virtual QString getStatusMessage() const = 0;
virtual ToxPk getPublicKey() const = 0;

View File

@ -27,6 +27,7 @@ class ToxPk;
class IDialogs
{
public:
virtual ~IDialogs() = default;
virtual bool hasContact(const ContactId& contactId) const = 0;
virtual bool isContactActive(const ContactId& contactId) const = 0;

View File

@ -28,6 +28,7 @@ class ToxPk;
class IDialogsManager
{
public:
virtual ~IDialogsManager() = default;
virtual IDialogs* getFriendDialogs(const ToxPk& friendPk) const = 0;
virtual IDialogs* getGroupDialogs(const GroupId& groupId) const = 0;
};

View File

@ -37,6 +37,7 @@ public:
enum class SetAvatarResult {
OK, EmptyPath, CanNotOpen, CanNotRead, TooLarge
};
virtual ~IProfileInfo() = default;
virtual bool setPassword(const QString& password) = 0;
virtual bool deletePassword() = 0;

View File

@ -39,6 +39,8 @@ public:
};
Q_DECLARE_FLAGS(AutoAcceptCallFlags, AutoAcceptCall)
virtual ~IFriendSettings() = default;
virtual QString getContactNote(const ToxPk& pk) const = 0;
virtual void setContactNote(const ToxPk& pk, const QString& note) = 0;

View File

@ -27,6 +27,8 @@
class IVideoSettings {
public:
virtual ~IVideoSettings() = default;
virtual QString getVideoDev() const = 0;
virtual void setVideoDev(const QString& deviceSpecifier) = 0;