extragear/multimedia/amarok/src

Ian Monroe ian.monroe at gmail.com
Fri Feb 20 18:11:39 CET 2009


On Fri, Feb 20, 2009 at 11:04 AM, Mark Kretschmann <kretschmann at kde.org> wrote:
> SVN commit 929114 by markey:
>
> Beginnings of SmartPointerList class:
> A QList for storing pointers to QObjects, that automatically removes
> the pointers when objects are deleted.
>
> The evil scheme behind this idea is to fix many of our crashes that
> result from storing (caching) QLists of pointers to QActions in various
> places in Amarok. The problem is that sometimes these QActions get
> deleted, and we end up with dangling pointers in these lists. That's
> causing crashes like in BR 184630, when we dereference these dangling
> pointers.
>
> Now my class does have a few drawbacks still, which may be fixable with
> more tweaking, or maybe not:
>
> * Does not work with Qt's foreach(), as it subclasses QObject. You need
>  to iterate over the list in traditional ways.

foreach works on all the lists in Qt, even though they don't derive
from each other. All you have to do is figure out what methods it
needs implemented. Probably a matter of just keeping the foreach and
seeing what errors gcc gives you.

Ian


More information about the Amarok-devel mailing list