Details
Description
There is crash (Email Client API 0) when trying to get text content from message containers using QMessageContentContainer::textContent() method. Crash appears when application is closing.
To reproduce and analyse code please refer to MessageProperties test application in attachment.
Test account: hardstuff12@gmail.com, password: 123xbest
We found issues in qfsengine_symbian.cpp that can cause crash:
- check code in CFSEngine::addMessagePartsToQMessage
TRAPD(err, pContent = mEmailMessage.ContentL()); if ((err == KErrNone) && pContent) { // Message MIME type QByteArray mimeHeader = QString::fromUtf16(pContent->ContentType().Ptr(), pContent->ContentType().Length()).toAscii(); MessagingHelper::extractMIMEHeaderParts(mimeHeader, mimeType, mimeSubType, charset); QMessageContentContainerPrivate* container = QMessagePrivate::containerImplementation(message); container->_type = mimeType; container->_subType = mimeSubType; addContentToQMessage(message, *pContent, msgId); size = pContent->TotalSize(); pContent->Release(); }
According to description in header MEmailMessage::ContentL() doesn't transfer ownership. pContent shouldn't be released.
- similar problem in CFSEngine::bodyContent
TRAP(err, pEmailMessage = mailbox->MessageL(bodyContentId.iMessageId)); if (err == KErrNone) { MEmailMessageContent* emailContent = NULL; TRAP(err, emailContent = pEmailMessage->ContentL()); if (err == KErrNone) { MEmailTextContent* bodyContent = textContentById(bodyContentId, emailContent); if (bodyContent) { TPtrC contentPtr(KNullDesC); TRAPD(err, contentPtr.Set(bodyContent->ContentL())); if (err == KErrNone) { content = QString::fromUtf16(contentPtr.Ptr(), contentPtr.Length()); } bodyContent->Release(); } }
textContentById() method returns ownership of emailContent if container is not multipart, so bodyContent shouldn't be released in this case.
Please review described cases.