summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/mime/mimetreeparser/messagepart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/domain/mime/mimetreeparser/messagepart.cpp')
-rw-r--r--framework/src/domain/mime/mimetreeparser/messagepart.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/framework/src/domain/mime/mimetreeparser/messagepart.cpp b/framework/src/domain/mime/mimetreeparser/messagepart.cpp
index d955e663..b4db4016 100644
--- a/framework/src/domain/mime/mimetreeparser/messagepart.cpp
+++ b/framework/src/domain/mime/mimetreeparser/messagepart.cpp
@@ -61,6 +61,9 @@ MessagePart::MessagePart(ObjectTreeParser *otp, const QString &text, KMime::Cont
61 61
62MessagePart::~MessagePart() 62MessagePart::~MessagePart()
63{ 63{
64 for (auto n : mNodesToDelete) {
65 delete n;
66 }
64} 67}
65 68
66/* 69/*
@@ -309,6 +312,11 @@ QVector<EncryptedMessagePart*> MessagePart::encryptions() const
309 return list; 312 return list;
310} 313}
311 314
315void MessagePart::bindLifetime(KMime::Content *node)
316{
317 mNodesToDelete << node;
318}
319
312//-----MessagePartList---------------------- 320//-----MessagePartList----------------------
313MessagePartList::MessagePartList(ObjectTreeParser *otp, KMime::Content *node) 321MessagePartList::MessagePartList(ObjectTreeParser *otp, KMime::Content *node)
314 : MessagePart(otp, QString(), node) 322 : MessagePart(otp, QString(), node)
@@ -390,6 +398,7 @@ void TextMessagePart::parseContent()
390 content->setBody(block.text()); 398 content->setBody(block.text());
391 content->parse(); 399 content->parse();
392 EncryptedMessagePart::Ptr mp(new EncryptedMessagePart(mOtp, QString(), cryptProto, fromAddress, nullptr, content)); 400 EncryptedMessagePart::Ptr mp(new EncryptedMessagePart(mOtp, QString(), cryptProto, fromAddress, nullptr, content));
401 mp->bindLifetime(content);
393 mp->setIsEncrypted(true); 402 mp->setIsEncrypted(true);
394 appendSubPart(mp); 403 appendSubPart(mp);
395 continue; 404 continue;
@@ -398,6 +407,7 @@ void TextMessagePart::parseContent()
398 content->setBody(block.text()); 407 content->setBody(block.text());
399 content->parse(); 408 content->parse();
400 SignedMessagePart::Ptr mp(new SignedMessagePart(mOtp, QString(), cryptProto, fromAddress, nullptr, content)); 409 SignedMessagePart::Ptr mp(new SignedMessagePart(mOtp, QString(), cryptProto, fromAddress, nullptr, content));
410 mp->bindLifetime(content);
401 mp->setIsSigned(true); 411 mp->setIsSigned(true);
402 appendSubPart(mp); 412 appendSubPart(mp);
403 continue; 413 continue;
@@ -945,6 +955,7 @@ void SignedMessagePart::setVerificationResult(const CryptoBodyPartMemento *m, KM
945 auto tempNode = new KMime::Content(); 955 auto tempNode = new KMime::Content();
946 tempNode->setContent(KMime::CRLFtoLF(mVerifiedText.constData())); 956 tempNode->setContent(KMime::CRLFtoLF(mVerifiedText.constData()));
947 tempNode->parse(); 957 tempNode->parse();
958 bindLifetime(tempNode);
948 959
949 if (!tempNode->head().isEmpty()) { 960 if (!tempNode->head().isEmpty()) {
950 tempNode->contentDescription()->from7BitString("signed data"); 961 tempNode->contentDescription()->from7BitString("signed data");
@@ -1028,6 +1039,7 @@ void EncryptedMessagePart::startDecryption(const QByteArray &text, const QTextCo
1028 KMime::Content *content = new KMime::Content; 1039 KMime::Content *content = new KMime::Content;
1029 content->setBody(text); 1040 content->setBody(text);
1030 content->parse(); 1041 content->parse();
1042 bindLifetime(content);
1031 1043
1032 startDecryption(content); 1044 startDecryption(content);
1033 1045
@@ -1188,6 +1200,7 @@ void EncryptedMessagePart::startDecryption(KMime::Content *data)
1188 auto tempNode = new KMime::Content(); 1200 auto tempNode = new KMime::Content();
1189 tempNode->setContent(KMime::CRLFtoLF(mDecryptedData.constData())); 1201 tempNode->setContent(KMime::CRLFtoLF(mDecryptedData.constData()));
1190 tempNode->parse(); 1202 tempNode->parse();
1203 bindLifetime(tempNode);
1191 1204
1192 if (!tempNode->head().isEmpty()) { 1205 if (!tempNode->head().isEmpty()) {
1193 tempNode->contentDescription()->from7BitString("encrypted data"); 1206 tempNode->contentDescription()->from7BitString("encrypted data");