Bug 374641

Summary: Some applications crash on exit
Product: [Frameworks and Libraries] QtCurve Reporter: Eugene Shalygin <eugene.shalygin+bugzilla.kde>
Component: qt5Assignee: Yichao Yu <yyc1992>
Status: RESOLVED DUPLICATE    
Severity: crash CC: hein, rjvbertin
Priority: NOR    
Version: git   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Eugene Shalygin 2017-01-06 17:05:31 UTC
Some applications crash on exit with the stacktrace pointing to DBus. KDevelop and KDialog are among those who crash. At the same time there are many that do not crash, for example Dolphin. It seems that in cases when Style class destructor is called, app exist without a crash, but when there is no call to Style::~Style(), crash follows. I've added qDebug() printouts and here are two examples:
$ dolphin 
QtCurve::Style::Style()
void QtCurve::Style::connectDBus()
QtCurve::Style::Style()
void QtCurve::Style::connectDBus()
virtual QtCurve::Style::~Style()
void QtCurve::Style::disconnectDBus()
virtual QtCurve::Style::~Style()
void QtCurve::Style::disconnectDBus()
$ echo $?
0

and
$ kdialog > /dev/null
QtCurve::Style::Style()
void QtCurve::Style::connectDBus()
void QtCurve::Style::disconnectDBus()
KCrash: Application 'kdialog' crashing...

Here is a stacktrace from kdialog:

Thread 1 "kdialog" received signal SIGSEGV, Segmentation fault.
0x00007ffff23e4bc5 in QMutex::lock() () from /usr/lib64/libQt5Core.so.5
(gdb) bt
#0  0x00007ffff23e4bc5 in QMutex::lock() () from /usr/lib64/libQt5Core.so.5
#1  0x00007ffff3e66876 in QDBusConnectionManager::busConnection(QDBusConnection::BusType) () from /usr/lib64/libQt5DBus.so.5
#2  0x00007ffff3e677cc in QDBusConnection::sessionBus() () from /usr/lib64/libQt5DBus.so.5
#3  0x00007fffe065edef in QtCurve::Style::disconnectDBus (this=0x6b1a50) at /home/eugene/develop/KDE/live/qtcurve/qt5/style/qtcurve.cpp:705
#4  0x00007fffe069e516 in QtCurve::runAllCleanups () at /home/eugene/develop/KDE/live/qtcurve/qt5/style/qtcurve_plugin.cpp:86
#5  0x00007fffe069e6c7 in QtCurve::StylePlugin::~StylePlugin (this=0x6957e0, __in_chrg=<optimized out>)
    at /home/eugene/develop/KDE/live/qtcurve/qt5/style/qtcurve_plugin.cpp:167
#6  0x00007fffe069e6e9 in QtCurve::StylePlugin::~StylePlugin (this=0x6957e0, __in_chrg=<optimized out>)
    at /home/eugene/develop/KDE/live/qtcurve/qt5/style/qtcurve_plugin.cpp:170
#7  0x00007ffff2577b31 in QLibraryPrivate::unload(QLibraryPrivate::UnloadFlag) () from /usr/lib64/libQt5Core.so.5
#8  0x00007ffff256e742 in QFactoryLoaderPrivate::~QFactoryLoaderPrivate() () from /usr/lib64/libQt5Core.so.5
#9  0x00007ffff256e869 in QFactoryLoaderPrivate::~QFactoryLoaderPrivate() () from /usr/lib64/libQt5Core.so.5
#10 0x00007ffff25acd77 in QObject::~QObject() () from /usr/lib64/libQt5Core.so.5
#11 0x00007ffff256dcb1 in QFactoryLoader::~QFactoryLoader() () from /usr/lib64/libQt5Core.so.5
#12 0x00007ffff2e46729 in (anonymous namespace)::Q_QGS_loader::innerFunction()::Holder::~Holder() () from /usr/lib64/libQt5Widgets.so.5
#13 0x00007ffff16d2c48 in __run_exit_handlers () from /lib64/libc.so.6
#14 0x00007ffff16d2c95 in exit () from /lib64/libc.so.6
#15 0x00007ffff23f8004 in QCommandLineParser::showHelp(int) () from /usr/lib64/libQt5Core.so.5
#16 0x000000000040fe1c in main ()

I looked in Breeze sources, and did not find DBus cleaning code there. I don't know whether it is a error with QtCurve at all. Maybe it is frameworkintegration does its integration incorrectly...
Comment 1 Eugene Shalygin 2017-01-06 17:14:40 UTC
BTW, this is without address sanitizer.
Comment 2 RJVB 2017-01-06 18:14:16 UTC

*** This bug has been marked as a duplicate of bug 363753 ***