Revision 929114

Go back to digest for 22nd February 2009

Bug Fixes in Multimedia

Mark Kretschmann committed changes in /trunk/extragear/multimedia/amarok/src:

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.
* Casting of pointers is sometimes needed

For testing, I did start to port some of our QList<QAction*> to SmartPointerList, but not all of them.

You be the judge if this class is a good idea and a viable path.
I'm requesting code review and discussion.

File Changes

Added 2 files
  • /trunk/extragear/multimedia/amarok/src
  •   /SmartPointerList.cpp
  •   /SmartPointerList.h
Modified 7 files
  • /trunk/extragear/multimedia/amarok/src
  •   /CMakeLists.txt
  •   /GlobalCurrentTrackActions.cpp
  •   /GlobalCurrentTrackActions.h
  •   /Systray.cpp
  •   /Systray.h
  •   /widgets/MainToolbar.cpp
  •   /widgets/MainToolbar.h
9 files changed in total