Commit c44e8d91 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix mem leak + rename variables etc.

parent 84ed485f
Pipeline #83145 passed with stage
in 26 minutes and 28 seconds
......@@ -10,8 +10,8 @@
MailMergeConfigureWidget::MailMergeConfigureWidget(QWidget *parent)
: QWidget(parent)
, mWidget(new Ui::MailMergeConfigureWidget)
{
mWidget = new Ui::MailMergeConfigureWidget;
mWidget->setupUi(this);
}
......
......@@ -7,6 +7,7 @@
#pragma once
#include <QWidget>
#include <memory>
namespace Ui
{
class MailMergeConfigureWidget;
......@@ -20,5 +21,5 @@ public:
~MailMergeConfigureWidget() override;
private:
Ui::MailMergeConfigureWidget *mWidget = nullptr;
std::unique_ptr<Ui::MailMergeConfigureWidget> mWidget;
};
......@@ -220,8 +220,8 @@ QPixmap AttachPropertyDialog::loadRenderingPixmap(KTNEFPropertySet *pSet, const
if (type == 1 && w > 0 && h > 0) {
// Load WMF data
QWinMetaFile wmfLoader;
QByteArray qb = wmf.toByteArray();
QBuffer wmfBuffer(&qb);
QByteArray qb2 = wmf.toByteArray();
QBuffer wmfBuffer(&qb2);
wmfBuffer.open(QIODevice::ReadOnly);
if (wmfLoader.load(wmfBuffer)) {
pix.scaled(w, h, Qt::KeepAspectRatio);
......
......@@ -164,9 +164,7 @@ bool QWinMetaFile::load(QBuffer &buffer)
mTextAlign = 0;
mRotation = 0;
mTextColor = Qt::black;
if (mFirstCmd) {
delete mFirstCmd;
}
delete mFirstCmd;
mFirstCmd = nullptr;
st.setDevice(&buffer);
......
......@@ -203,7 +203,9 @@ protected:
protected:
QPainter mPainter;
bool mIsPlaceable, mIsEnhanced, mValid;
bool mIsPlaceable = false;
bool mIsEnhanced = false;
bool mValid = false;
// coordinate system
bool mAbsoluteCoord;
......@@ -214,9 +216,9 @@ protected:
// information shared between Metafile Functions
QColor mTextColor;
int mTextAlign, mRotation;
bool mWinding;
bool mWinding = false;
WmfCmd *mFirstCmd;
WmfCmd *mFirstCmd = nullptr;
WinObjHandle **mObjHandleTab;
QPolygon mPoints;
int mDpi;
......
......@@ -181,6 +181,7 @@
#include <QSplitter>
#include <QStandardPaths>
#include <QStatusBar>
#include <QUrlQuery>
// GPGME
#include <gpgme++/key.h>
......@@ -742,8 +743,7 @@ void KMComposerWin::readConfig(bool reload)
if (!KMailSettings::self()->snippetSplitterPosition().isEmpty()) {
mSnippetSplitter->setSizes(KMailSettings::self()->snippetSplitterPosition());
} else {
QList<int> defaults;
defaults << (int)(width() * 0.8) << (int)(width() * 0.2);
const QList<int> defaults{(int)(width() * 0.8), (int)(width() * 0.2)};
mSnippetSplitter->setSizes(defaults);
}
}
......@@ -1522,8 +1522,7 @@ void KMComposerWin::initializePluginActions()
const QString actionlistname =
QLatin1String("kmaileditor") + MessageComposer::PluginActionType::actionXmlExtension(MessageComposer::PluginActionType::Tools);
for (KToggleAction *act : customToolsWidgetActionList) {
QList<QAction *> lst;
lst << act;
QList<QAction *> lst{act};
if (hashActions.contains(actionlistname)) {
lst = hashActions.value(actionlistname) + lst;
hashActions.remove(actionlistname);
......@@ -1689,7 +1688,7 @@ void KMComposerWin::setMessage(const KMime::Message::Ptr &newMsg,
mLastEncryptActionState = true;
}
auto im = KMKernel::self()->identityManager();
const auto im = KMKernel::self()->identityManager();
if (auto hrd = newMsg->headerByType("X-KMail-Identity")) {
const QString identityStr = hrd->asUnicodeString();
......
......@@ -70,10 +70,10 @@ void CreateNewContactJob::slotCollectionsFetched(KJob *job)
const Akonadi::AgentType agentType = dlg->agentType();
delete dlg;
if (agentType.isValid()) {
auto job = new Akonadi::AgentInstanceCreateJob(agentType, this);
connect(job, &Akonadi::AgentInstanceCreateJob::result, this, &CreateNewContactJob::slotResourceCreationDone);
job->configure(mParentWidget);
job->start();
auto createAgentJob = new Akonadi::AgentInstanceCreateJob(agentType, this);
connect(createAgentJob, &Akonadi::AgentInstanceCreateJob::result, this, &CreateNewContactJob::slotResourceCreationDone);
createAgentJob->configure(mParentWidget);
createAgentJob->start();
return;
} else { // if agent is not valid => return error and finish job
setError(UserDefinedError);
......
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