Uploaded image for project: 'Qt Mobility'
  1. Qt Mobility
  2. QTMOBILITY-1504

Crash on application close when using QMessageContentContainer::textContent()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 1.2.x
    • 1.2.x
    • Messaging
    • None
    • Symbian, Nokia N8 SW version 2011.11, Qt 4.7.2 + qt-mobility:master
    • b064afac6f9a75cf7a4486e1e06e794595261dd9

    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.

      Attachments

        Activity

          People

            sanders Don Sanders (closed Nokia identity) (Inactive)
            szewczyk Pawel Szewczyk
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: