Commit 08aa72d6 authored by Laurent Montel's avatar Laurent Montel 😁

Fix mem leak found by asan

parent 3b392fa7
......@@ -38,7 +38,7 @@ MessageFactoryForwardJob::~MessageFactoryForwardJob()
void MessageFactoryForwardJob::start()
{
TemplateParser::TemplateParserJob *parser = new TemplateParser::TemplateParserJob(mMsg, TemplateParser::TemplateParserJob::Forward);
TemplateParser::TemplateParserJob *parser = new TemplateParser::TemplateParserJob(mMsg, TemplateParser::TemplateParserJob::Forward, this);
connect(parser, &TemplateParser::TemplateParserJob::parsingDone, this, &MessageFactoryForwardJob::slotParsingDone);
parser->setIdentityManager(mIdentityManager);
parser->setCharsets(MessageComposerSettings::self()->preferredCharsets());
......
......@@ -35,7 +35,7 @@ MessageFactoryReplyJob::~MessageFactoryReplyJob()
void MessageFactoryReplyJob::start()
{
TemplateParser::TemplateParserJob *parser = new TemplateParser::TemplateParserJob(mMsg, (mReplyAll ? TemplateParser::TemplateParserJob::ReplyAll : TemplateParser::TemplateParserJob::Reply));
TemplateParser::TemplateParserJob *parser = new TemplateParser::TemplateParserJob(mMsg, (mReplyAll ? TemplateParser::TemplateParserJob::ReplyAll : TemplateParser::TemplateParserJob::Reply), this);
connect(parser, &TemplateParser::TemplateParserJob::parsingDone, this, &MessageFactoryReplyJob::slotReplyDone);
parser->setIdentityManager(mIdentityManager);
parser->setCharsets(MessageComposerSettings::self()->preferredCharsets());
......
......@@ -108,8 +108,9 @@ void TemplateParserJobPrivate::setAllowDecryption(const bool allowDecryption)
mEmptySource->setDecryptMessage(mAllowDecryption);
}
TemplateParserJob::TemplateParserJob(const KMime::Message::Ptr &amsg, const Mode amode)
: d(new TemplateParserJobPrivate(amsg, amode))
TemplateParserJob::TemplateParserJob(const KMime::Message::Ptr &amsg, const Mode amode, QObject *parent)
: QObject(parent)
, d(new TemplateParserJobPrivate(amsg, amode))
{
}
......@@ -265,6 +266,7 @@ void TemplateParserJob::process(const KMime::Message::Ptr &aorig_msg, qint64 afo
if (aorig_msg == nullptr) {
qCDebug(TEMPLATEPARSER_LOG) << "aorig_msg == 0!";
Q_EMIT parsingDone(d->mForceCursorPosition);
deleteLater();
return;
}
......@@ -273,6 +275,7 @@ void TemplateParserJob::process(const KMime::Message::Ptr &aorig_msg, qint64 afo
const QString tmpl = findTemplate();
if (tmpl.isEmpty()) {
Q_EMIT parsingDone(d->mForceCursorPosition);
deleteLater();
return;
}
processWithTemplate(tmpl);
......@@ -1128,6 +1131,7 @@ void TemplateParserJob::slotExtractInfoDone(const TemplateParserExtractHtmlInfoR
addProcessedBodyToMessage(plainBody, htmlBody);
Q_EMIT parsingDone(d->mForceCursorPosition);
deleteLater();
}
QString TemplateParserJob::getPlainSignature() const
......
......@@ -163,7 +163,7 @@ public:
};
public:
explicit TemplateParserJob(const KMime::Message::Ptr &amsg, const Mode amode);
explicit TemplateParserJob(const KMime::Message::Ptr &amsg, const Mode amode, QObject *parent = nullptr);
~TemplateParserJob();
/**
......
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