On Friday 21 October 2005 23:29, Michael Pyne wrote:
> On Friday 21 October 2005 11:42, Ivor Hewitt wrote:
> > On Wednesday 19 October 2005 16:43, Jimmy Gilles wrote:
> > > It works very well but my problem is that when "list" is deleted, keys
> > > that are in this list are not deleted. Why ?
> > > I use QPointer to automaticaly delete keys but it doesn't work.

> >
> > Destroying a QPointer does not destroy the object it points to.

>
> And for a perhaps more useful answer, add a destructor for KgpgListKeys that
> iterates over its keys and deletes them. You might not be able to use
> foreach() since the dtor will be iterating over itself but something like
> this would work:
>
> KgpgListKeys::~KgpgListKeys()
> {
> for(ConstIterator it = constBegin(); it != constEnd(); ++it)
> {
> delete *it;
> }


qDeleteAll(this) should do the same as the above code.

--
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<