[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    Re: Memory usage (Re: QCString construction)
From:       David Faure <dfaure () klaralvdalens-datakonsult ! se>
Date:       2007-02-19 16:04:58
Message-ID: 200702191705.06752.dfaure () klaralvdalens-datakonsult ! se
[Download RAW message or body]

On Friday 16 February 2007, Ingo Klöcker wrote:
> KMMessage::KMMessage(DwMessage* aMsg)

In fact I'm confused about why things work now... When writing

QByteArray KMMessage::asSendableString() const
{
  KMMessage msg( this->mMsg );
  msg.removePrivateHeaderFields();
  msg.removeHeaderField("Bcc");
  [...]

the goal is that "this" isn't modified (doesn't lost its private header fields or its Bcc header).
But looking at the code, there is no 'detach' going on when calling mMsg->Headers()
and header.RemoveField(field). So this is modifying the message behind "this", isn't it?

The really strange thing is that I can't confirm this by experience. When sending mail,
the mail in the outbox and later in sent-mail, has the Bcc field just fine. I think, in fact, that
the message simply happens to be saved before the above code runs. KMSender runs
delayed, and mCurrentMsg is simply forgotten (set to 0) after sending the mail, so it
doesn't matter that it has been modified.
mCurrentMsg = mOutboxFolder->getMsg(mFailedMessages) gives us a KMMessage
that we can modify without affecting the outbox, right?

If the above analysis is correct, then my idea makes the code quite fragile, even if it works right now.
It should be a non-const method, convertToSendableMessage(), that KMSender calls on mCurrentMsg.
Do you agree?

-- 
David Faure, faure@kde.org, dfaure@klaralvdalens-datakonsult.se
KDE/KOffice developer, Qt consultancy projects
Klarälvdalens Datakonsult AB, Platform-independent software solutions
_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic