[Kde-pim] KMCommand constructors
Jonathan Armond
jon.armond at gmail.com
Thu Jun 4 10:45:44 BST 2009
Ingo Klöcker wrote:
> 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.
Agreed. I'll try to use serial numbers for new subclasses. I just wondered
if it was standard practice as constructors are there for it.
Jon
_______________________________________________
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