[Kde-pim] KMCommand constructors

Ingo Klöcker kloecker at kde.org
Wed Jun 3 23:40:09 BST 2009


On Wednesday 03 June 2009, Jonathan Armond wrote:
> Does anyone know why KMSetStatusCommand uses serial numbers
> instead of KMMsgBase*'s?
>
> Isn't it easier to just pass up the list of KMMsgBase to the
> base class KMCommand constructor? Or does is transferring of
> messages this seems to cause reserved for commands like Copy and
> Move?

Quite frankly, passing references to objects around as pointers is evil 
because the pointers might become dangling pointers at any point in 
time (e.g. if KMail replaces a KMMsgBase by a full-fledged KMMessage). 
Passing the references as serial numbers makes the code much more 
robust and IMHO it should be preferred over passing pointers around.


Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20090604/818bb458/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list