KDirOperator::resetCursor() crash

David Faure faure at kde.org
Tue Oct 16 15:04:15 BST 2007


On Tuesday 16 October 2007, Matt Rogers wrote:
> On Tuesday 16 October 2007 06:16:31 Jarosław Staniek wrote:
> > David Faure said the following, On 2007-10-16 13:01:
> > > On Tuesday 16 October 2007, Jarosław Staniek wrote:
> > >> In my app there is a structure declared with K_GLOBAL_STATIC containing
> > >> a pointer to GUI with KFileWidget.
> > >
> > > I don't think this is a good idea. Complex widgets don't make good
> > > "global static" objects, because of the things they might need in their
> > > destructors indeed.
> > >
> > > I don't mind a if(qApp) being added, but I do think that this is a bad
> > > idea and that you should create the file widget when you need it, and
> > > delete it when you don't need it anymore.
> >
> > That was my thought as well but since even bad habits shouldn't cause the
> > crash I'd like to do both things: (1) avoid having the static GUI parts
> > allocated after qApp is destructed (2) commit the fix for sanity.
> 
> Could we add an assert instead? Some say that's just as bad as crashing but at 
> least we can tell people why their app is crashing instead of just 
> crashing. :)

Well, not in this case. I mean, if we don't call restoreOverrideCursor just before the QApplication
terminates, so what? We can just skip that, so better do that (and provide a solid framework,
as long as nothing else is done from those destructors) than be unnecessarily strict ("you can't
do that, we decided it to be that way, even though it would actually work, or could work with
a simple if() added").

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list