SmartPointerList

Thiago Macieira thiago at kde.org
Mon Jan 11 10:01:01 GMT 2010


Em Segunda-feira 11 Janeiro 2010, às 10:41:47, Mark Kretschmann escreveu:
> Hey all,
> 
> I just wanted to point you to a class that we wrote for Amarok, and
> that we find very useful in many situations, so I was wondering if
> there is any interest in getting it into KDElibs.
> 
> What it does is quite simple:
> 
> Gives you a QList for pointers (to QObjects), and if an object in it
> is destroyed, its pointer gets removed from this list automatically.
> We found that this can prevent a great deal of issues with dangling
> pointers stored in lists (often a design mistake, but it can happen).
> You be the judge if you find this class useful or not.
> 
> You can find it here:
> 
> http://gitorious.org/amarok/amarok/blobs/master/src/SmartPointerList.h
> http://gitorious.org/amarok/amarok/blobs/master/src/SmartPointerList.cpp

I think this was proposed before.

But isn't it the same as QList<QWeakPointer<T> > ?

Except that the item isn't removed from the list once it's deleted. It just 
becomes zero.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100111/0f9b1340/attachment.sig>


More information about the kde-core-devel mailing list