[KPhotoAlbum] Deallocation in KPA

Steffen Jost steffenjost at web.de
Wed Jan 18 08:50:59 GMT 2012


How is deallocation handled in KPA?

The current HTMLDialog already has a QList, QMap and an IdList(?) for 
which I cannot find any qDeleteAll. Is this a memory leak?

In the Qt documentation I read that instance variables which are 
descendants of QObject are automatically deallocated with the QObject 
they belong to, except for containers, which should be explicitly 
deallocated with qDeleteAll, especially if the containers just contain 
pointers (like in these cases).

I am asking because I added two QStringList objects and a pointer to a 
QLabel to HTMLDialog (for the theme descriptions), and wonder how these 
should be deallocated once the dialog is closed. However, I cannot find 
examples of deallocation anywhere within HTMLDialog. There is no 
explicit destructor declaration of HTMLDialog either. Also, what happens 
to all these intermediate objects, e.g. a local variable pointing to 
QString objects just used once to create a label and such?

(Of course, these three objects I added are tiny (<2KB) and their 
deallocation is probably insignificant since it is highly unlikely that 
a user reopens the HTML export dialog more than a dozen times during the 
runtime of KPA, but I don't want to be blamed for introducing bad code.)

Thanks, Steffen.



More information about the Kphotoalbum mailing list