~KDirLister accessing already destroyed object

Matthias Kretz kretz at kde.org
Mon Oct 1 10:44:31 BST 2007


On Monday 01 October 2007, David Faure wrote:
> On Monday 01 October 2007, Olivier Goffart wrote:
> > Le lundi 1 octobre 2007, David Faure a écrit :
> > > On Monday 01 October 2007, Dennis Nienhüser wrote:
> > > > I'm trying to fix a crash that occurs when closing Kopete and think
> > > > it's caused by the KDirLister destructor. ~KDirLister calls stop() on
> > > > its cache, which is a singleton created by the K_GLOBAL_STATIC macro
> > > > and seems to get destroyed before ~KDirLister is called on my system.
> > >
> > > Why is that? Your KDirLister is a global static too? That seems like a
> > > very strange idea....
> >
> > The KDirLister is a child object of a global static singleton.
>
> We have to limit our use of global statics. Their order of deletion is
> undefined, which gives problems such as this one.
> But OK for the patch, since others will for sure hit this problem one day
> or another. + if (KDirListerCache::self())
> reads a bit strange, one would never expect it to return 0, maybe better to
> use if (s_pCache.isDestroyed()) directly instead? Or is the self() fix
> required anyway for other places?

Patch attached that cleans up KDirListerCache::self()

-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdirlister.patch
Type: text/x-diff
Size: 3679 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071001/72ea773f/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071001/72ea773f/attachment.sig>


More information about the kde-core-devel mailing list