Commit cf2b63d1 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Consistently use std::unique_ptr to manage lifetime of pimpl object

GIT_SILENT
parent 375f51df
......@@ -102,7 +102,6 @@ SmtpJob::~SmtpJob()
}
}
}
delete d;
}
void SmtpJob::doStart()
......
......@@ -12,6 +12,8 @@
#include <KSMTP/Session>
#include <transportjob.h>
#include <memory>
namespace KIO
{
class Job;
......@@ -70,7 +72,7 @@ private:
private:
friend class ::SmtpJobPrivate;
SmtpJobPrivate *const d;
std::unique_ptr<SmtpJobPrivate> const d;
};
} // namespace MailTransport
......@@ -106,10 +106,7 @@ TransportPluginManager::TransportPluginManager(QObject *parent)
{
}
TransportPluginManager::~TransportPluginManager()
{
delete d;
}
TransportPluginManager::~TransportPluginManager() = default;
TransportPluginManager *TransportPluginManager::self()
{
......
......@@ -8,6 +8,9 @@
#include "kmailtransport_private_export.h"
#include <QObject>
#include <memory>
namespace MailTransport
{
class TransportAbstractPlugin;
......@@ -28,7 +31,7 @@ Q_SIGNALS:
void updatePluginList();
private:
TransportPluginManagerPrivate *const d;
std::unique_ptr<TransportPluginManagerPrivate> const d;
};
}
......@@ -56,10 +56,7 @@ PrecommandJob::PrecommandJob(const QString &precommand, QObject *parent)
});
}
PrecommandJob::~PrecommandJob()
{
delete d;
}
PrecommandJob::~PrecommandJob() = default;
void PrecommandJob::start()
{
......
......@@ -14,6 +14,8 @@
#include <KJob>
#include <memory>
class PreCommandJobPrivate;
namespace MailTransport
......@@ -57,7 +59,7 @@ protected:
private:
friend class ::PreCommandJobPrivate;
PreCommandJobPrivate *const d;
std::unique_ptr<PreCommandJobPrivate> const d;
};
} // namespace MailTransport
......@@ -532,14 +532,11 @@ ServerTest::ServerTest(QObject *parent)
connect(d->progressTimer, SIGNAL(timeout()), SLOT(slotUpdateProgress()));
}
ServerTest::~ServerTest()
{
delete d;
}
ServerTest::~ServerTest() = default;
void ServerTest::start()
{
qCDebug(MAILTRANSPORT_LOG) << d;
qCDebug(MAILTRANSPORT_LOG) << d.get();
d->connectionResults.clear();
d->authenticationResults.clear();
......
......@@ -13,6 +13,8 @@
#include <QList>
#include <QObject>
#include <memory>
class QProgressBar;
namespace MailTransport
......@@ -195,7 +197,7 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(ServerTest)
ServerTestPrivate *const d;
std::unique_ptr<ServerTestPrivate> const d;
Q_PRIVATE_SLOT(d, void slotNormalPossible())
Q_PRIVATE_SLOT(d, void slotTlsDone())
......
......@@ -124,7 +124,6 @@ Socket::Socket(QObject *parent)
Socket::~Socket()
{
qCDebug(MAILTRANSPORT_LOG);
delete d;
}
void Socket::reconnect()
......
......@@ -10,6 +10,8 @@
#include <QSslSocket>
#include <memory>
namespace MailTransport
{
class SocketPrivate;
......@@ -86,7 +88,7 @@ public:
private:
Q_DECLARE_PRIVATE(Socket)
SocketPrivate *const d;
std::unique_ptr<SocketPrivate> const d;
Q_PRIVATE_SLOT(d, void slotConnected())
Q_PRIVATE_SLOT(d, void slotStateChanged(QAbstractSocket::SocketState state))
......
......@@ -34,10 +34,7 @@ Transport::Transport(const QString &cfgGroup)
loadPassword();
}
Transport::~Transport()
{
delete d;
}
Transport::~Transport() = default;
bool Transport::isValid() const
{
......
......@@ -10,6 +10,8 @@
#include <transportbase.h>
#include <transporttype.h>
#include <memory>
class TransportPrivate;
namespace QKeychain
{
......@@ -142,7 +144,9 @@ private Q_SLOTS:
private:
void readTransportPasswordFinished(QKeychain::Job *baseJob);
void loadPassword();
TransportPrivate *const d;
private:
std::unique_ptr<TransportPrivate> const d;
};
} // namespace MailTransport
......@@ -37,7 +37,6 @@ TransportJob::TransportJob(Transport *transport, QObject *parent)
TransportJob::~TransportJob()
{
delete d->transport;
delete d;
}
void TransportJob::setSender(const QString &sender)
......
......@@ -12,6 +12,8 @@
#include <KCompositeJob>
#include <memory>
class QBuffer;
namespace MailTransport
......@@ -136,7 +138,7 @@ protected:
private:
//@cond PRIVATE
class Private;
Private *const d;
std::unique_ptr<Private> const d;
//@endcond
};
} // namespace MailTransport
......
......@@ -137,7 +137,6 @@ TransportManager::TransportManager()
TransportManager::~TransportManager()
{
qRemovePostRoutine(destroyStaticTransportManager);
delete d;
}
TransportManager *TransportManager::self()
......
......@@ -12,6 +12,8 @@
#include <QList>
#include <QObject>
#include <memory>
namespace KWallet
{
class Wallet;
......@@ -274,7 +276,7 @@ private:
void updatePluginList();
private:
TransportManagerPrivate *const d;
std::unique_ptr<TransportManagerPrivate> const d;
Q_PRIVATE_SLOT(d, void slotTransportsChanged())
};
......
......@@ -144,7 +144,6 @@ AddTransportDialogNG::AddTransportDialogNG(QWidget *parent)
AddTransportDialogNG::~AddTransportDialogNG()
{
d->writeConfig();
delete d;
}
void AddTransportDialogNG::accept()
......
......@@ -9,6 +9,8 @@
#include "kmailtransport_private_export.h"
#include <QDialog>
#include <memory>
namespace MailTransport
{
/**
......@@ -43,7 +45,7 @@ public:
private:
class Private;
Private *const d;
std::unique_ptr<Private> const d;
};
} // namespace MailTransport
......@@ -29,10 +29,7 @@ TransportComboBox::TransportComboBox(QWidget *parent)
connect(TransportManager::self(), &TransportManager::transportRemoved, this, &TransportComboBox::transportRemoved);
}
TransportComboBox::~TransportComboBox()
{
delete d;
}
TransportComboBox::~TransportComboBox() = default;
int TransportComboBox::currentTransportId() const
{
......
......@@ -11,6 +11,8 @@
#include <QComboBox>
#include <memory>
class TransportComboBoxPrivate;
namespace MailTransport
......@@ -61,7 +63,7 @@ public Q_SLOTS:
void updateComboboxList();
private:
TransportComboBoxPrivate *const d;
std::unique_ptr<TransportComboBoxPrivate> const d;
};
} // namespace MailTransport
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment