KAutoPointer: a new autoptr class for QPointer
David Jarvie
djarvie at kde.org
Wed Jul 8 18:19:43 BST 2009
There is a widespread issue in KDE applications, described by Frank
Osterfeld at http://www.kdedevelopers.org/node/3919, where if an
application is displaying a modal dialog when it receives a quit signal,
the dialog will be deleted by its parent's destructor and after the exec()
call returns, the application is likely to crash due either to double
deletion of the dialog, or use of the dangling pointer.
A new template class for kdelibs, KAutoPointer, is proposed in
http://reviewboard.kde.org/r/955/, which provides a combination of a
QPointer and and autoptr so that double deletion can be avoided, and
dangling pointers can be detected.
Ideally this class would be provided by Qt, but in the meantime it seems
useful to provide it in kdelibs.
--
David Jarvie.
KAlarm author & maintainer.
http://www.astrojar.org.uk/kalarm
More information about the kde-core-devel
mailing list