Version: 1.7.50 (using KDE 3.3.0, compiled sources) Compiler: gcc version 3.3.3 (SuSE Linux) OS: Linux (i686) release 2.6.5-7.108-default Send an PGP/MIME encrypted message to someone and BCC yourself. Two messages will be created (which is intended behavior). One message contains the encrypted message text, but the second message only contains an encrypted empty message part.
This problem is also present in KDE 3.3 and KDE 3.3.1.
CVS commit by kloecker: Fix PGP/MIME encrypting messages which are BCC'ed. The problem was that KMMessagePart contains a QByteArray which is explicitely shared. Therefore simply copying a KMMessagePart with the copy c'tor for getting a temporary copy isn't possible. Implementing and using a duplicate method fixes the problem. BUG: 92412 M +9 -0 kmmsgpart.cpp 1.113 M +4 -0 kmmsgpart.h 1.42 M +2 -1 messagecomposer.cpp 1.36 --- kdepim/kmail/kmmsgpart.h #1.41:1.42 @@ -23,4 +23,8 @@ public: void clear(); + /** Obtains an independant copy (i.e. without explicitely shared data) of the + data contained in msgPart. Returns a reference to this message part. */ + KMMessagePart & duplicate( const KMMessagePart & msgPart ); + /** Get or set the message body */ QCString body(void) const; --- kdepim/kmail/kmmsgpart.cpp #1.112:1.113 @@ -81,4 +81,13 @@ void KMMessagePart::clear() //----------------------------------------------------------------------------- +KMMessagePart & KMMessagePart::duplicate( const KMMessagePart & msgPart ) +{ + // copy the data of msgPart + *this = msgPart; + // detach the explicitely shared QByteArray + mBody.detach(); +} + +//----------------------------------------------------------------------------- int KMMessagePart::decodedSize(void) const { --- kdepim/kmail/messagecomposer.cpp #1.35:1.36 @@ -960,5 +960,6 @@ public: void execute() { - KMMessagePart tmpNewBodyPart = *mNewBodyPart; + KMMessagePart tmpNewBodyPart; + tmpNewBodyPart.duplicate( *mNewBodyPart ); // TODO: Async call
*** Bug 91697 has been marked as a duplicate of this bug. ***