New System Settings

Thomas Lübking thomas.luebking at web.de
Sat May 23 01:47:28 BST 2009


Am Saturday 23 May 2009 schrieb Ben Cooksley:
> If I made it a singleton, then I would have to reparent it as views
> needed it, which would lead to a really nasty crash upon closing
> because the module view would try to destroy the modules ( since they
> would have to be held in a internal list of some description ) except
> the reparented one had already been destroyed by Qt automatically.
QObjects emit a(n unblockable) signal on destruction that allows you to e.g. 
unlist them at that moment so you won't try to delete a garbage pointer.
There's even a QPointer<T> class handling this for you so instead "QWidget *w" 
you can just use "QPointer<QWidget> w" and safely ask "if (w)" or "delete w" 
anytime then (as w will be NULL for destroyed objects)

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090523/5bfa0218/attachment.htm>


More information about the kde-core-devel mailing list