Bug 257646

Summary: Crash on application cleanup in Oxygen Helper destructor
Product: [Plasma] Oxygen Reporter: David Jarvie <djarvie>
Component: styleAssignee: Hugo Pereira Da Costa <hugo.pereira.da.costa>
Status: RESOLVED FIXED    
Severity: crash CC: cfeck, hugo.pereira.da.costa
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description David Jarvie 2010-11-22 22:01:05 UTC
Version:           unspecified (using Devel) 
OS:                Linux

KAlarm trunk has crashed a couple of times on application exit with a similar crash trace, in ~KCleanUpGlobalStatic(), inside Oxygen destructors:

Application: KAlarm (kalarm), signal: Segmentation fault
[KCrash Handler]
#6  0xb52ab6b6 in QHashData::free_helper () from /opt/qt4.7/lib/libQtCore.so.4
#7  0xb421bf17 in QHash<unsigned long long, QCache<unsigned long long, Oxygen::TileSet>::Node>::freeData (this=0x9c6dfc8, x=0x9b60d78) at /opt/qt4.7/include/QtCore/qhash.h:568
#8  0xb421c17d in QHash<unsigned long long, QCache<unsigned long long, Oxygen::TileSet>::Node>::operator= (this=0x9c6dfc8, other=@0xbf880694) at /opt/qt4.7/include/QtCore/qhash.h:594
#9  0xb421c1cb in QHash<unsigned long long, QCache<unsigned long long, Oxygen::TileSet>::Node>::clear (this=0x9c6dfc8) at /opt/qt4.7/include/QtCore/qhash.h:574
#10 0xb421c22c in QCache<unsigned long long, Oxygen::TileSet>::clear (this=0x9c6dfc0) at /opt/qt4.7/include/QtCore/qcache.h:140
#11 0xb421c253 in ~QCache (this=0x9c6dfc0) at /opt/qt4.7/include/QtCore/qcache.h:103
#12 0xb421c275 in ~BaseCache (this=0x9c6dfc0) at /home/david/src/svn/trunk/KDE/kdebase/workspace/libs/oxygen/oxygenhelper.h:59
#13 0xb421c742 in QCache<unsigned long long, Oxygen::BaseCache<Oxygen::TileSet> >::clear (this=0x9b468c4) at /opt/qt4.7/include/QtCore/qcache.h:139
#14 0xb421c79d in ~QCache (this=0x9b468c4) at /opt/qt4.7/include/QtCore/qcache.h:103
#15 0xb421c7bf in ~BaseCache (this=0x9b468c4) at /home/david/src/svn/trunk/KDE/kdebase/workspace/libs/oxygen/oxygenhelper.h:59
#16 0xb421c7d3 in ~Cache (this=0x9b468c4) at /home/david/src/svn/trunk/KDE/kdebase/workspace/libs/oxygen/oxygenhelper.h:108
#17 0xb421cbe8 in ~Helper (this=0x9b46880) at /home/david/src/svn/trunk/KDE/kdebase/workspace/libs/oxygen/oxygenhelper.h:157
#18 0xb421cd46 in ~StyleHelper (this=0x9b46880) at /home/david/src/svn/trunk/KDE/kdebase/workspace/kstyles/oxygen/oxygenstylehelper.h:47
#19 0xb41d4a81 in destroy () at /home/david/src/svn/trunk/KDE/kdebase/workspace/kstyles/oxygen/oxygenstyle.cpp:103
#20 0xb420aa17 in ~KCleanUpGlobalStatic (this=0xb42395b4) at /opt/kde4/include/kglobal.h:62
#21 0xb4fb3ab9 in exit () from /lib/i686/cmov/libc.so.6
#22 0xb4f9b45d in __libc_start_main () from /lib/i686/cmov/libc.so.6
#23 0x080822b1 in _start ()

Reproducible: Sometimes

Steps to Reproduce:
Quit KAlarm (Akonadi version). Very occasionally produces the same crash.
Comment 1 Hugo Pereira Da Costa 2010-11-22 22:18:10 UTC
Hi David,

I suspect a bug in Qt, or (more likely) in KCleanUpGlobalStatic, being called too late. For a long long time, I had in mind to get rid of the globalstatic stuff in Oxygen (cause I hate statics in general). Maybe it is time to do so now ...
Comment 2 Hugo Pereira Da Costa 2010-11-22 22:18:46 UTC
... maybe I'll use a QSharedPointer that I will pass around.
Comment 3 David Jarvie 2010-11-22 23:15:45 UTC
Hi Hugo,

I wouldn't be surprised if there was a bug in KCleanUpGlobalStatic. I've had quite a number of crashes on KAlarm exit in trunk, but most of them don't provide a crash trace. The Oxygen one is just about the only one which I've managed to get a trace for. The other major candidate is the Akonadi libraries cleanup, but it's entirely possible that some are also in global cleanup.
Comment 4 Hugo Pereira Da Costa 2010-12-07 19:16:09 UTC
SVN commit 1204520 by hpereiradacosta:

Remove usage of statically allocated Oxygen::StyleHelper.
The helper is now a member of Oxygen::Style.
CCBUG: 257646


 M  +277 -286  oxygenstyle.cpp  
 M  +5 -1      oxygenstyle.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1204520
Comment 5 Hugo Pereira Da Costa 2010-12-07 19:17:07 UTC
Won't fix the akonadi crashes
but should fix the oxygen::styleHelper crashes at cleanup.
Please close the bug if it does not happen any more for quite some time.
Comment 6 Christoph Feck 2011-08-05 14:37:59 UTC
I am not sure if the patch from comment #4 made it into the 4.6 branch, but there are some similar bugs from 4.6.x: bug 274444, bug 275656, bug 277308.
Comment 7 Hugo Pereira Da Costa 2011-08-05 14:58:19 UTC
@Christoph
The patch did make it to KDE4.6.
And in fact is reflected by the crash report you posted.
~StyleHelper is now deleted via ~Style and not via KCleanUpGlobalStatic.
Which is good.

That it still crashes is ... well ... unfortunate ...
Will have to investigate the reports one by one since they are actually different :(