Ingo Klöcker kloecker at
Mon Jan 11 21:52:07 GMT 2010

On Monday 11 January 2010, Thiago Macieira wrote:
> Em Segunda-feira 11 Janeiro 2010, às 10:41:47, Mark Kretschmann 
> > 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:
> >
> >
> >t.h
> >
> >t.cpp
> I think this was proposed before.
> But isn't it the same as QList<QWeakPointer<T> > ?

From the description I'd have said that it's more like QList< QPointer< 
T > >, but then I saw that QWeakPointer<T> is a wild mix of QPointer<T> 
and boost::weak_ptr<T>. *sigh*

QWeakPointer::QWeakPointer ( const QObject * obj )
You can use this constructor with any QObject, even if they were not 
created with QSharedPointer.
Note that QWeakPointers created this way on arbitrary QObjects usually 
cannot be promoted to QSharedPointer.

Why did you have to ruin the beauty of a simple weak-pointer class by 
adding functionality that's already provided by another class in Qt? 
Why didn't you follow rule number one ("Be minimal") of

-------------- 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: <>

More information about the kde-core-devel mailing list