On 2012-12-06 18:12, Mark Atkinson wrote: > Short backstory, I had recently upgraded my workstation to the latest > current which included clang as default cc now. ... > qdbus under kde segfaults in malloc with a huge recursion stack: > > [...] > #44740 0x282f7bd4 in QObject::QObject () from > /usr/local/lib/qt4/libQtCore.so.4 > #44741 0x281cb649 in QAdoptedThread::QAdoptedThread () from > /usr/local/lib/qt4/libQtCore.so.4 > #44742 0x281ce146 in QThreadData::current () from > /usr/local/lib/qt4/libQtCore.so.4 > #44743 0x282f7bd4 in QObject::QObject () from > /usr/local/lib/qt4/libQtCore.so.4 > #44744 0x281cb649 in QAdoptedThread::QAdoptedThread () from > /usr/local/lib/qt4/libQtCore.so.4 > #44745 0x281ce146 in QThreadData::current () from > /usr/local/lib/qt4/libQtCore.so.4 > #44746 0x282f7bd4 in QObject::QObject () from > /usr/local/lib/qt4/libQtCore.so.4 > #44747 0x281cb649 in QAdoptedThread::QAdoptedThread () from > /usr/local/lib/qt4/libQtCore.so.4 > #44748 0x281ce146 in QThreadData::current () from > /usr/local/lib/qt4/libQtCore.so.4 > #44749 0x281cbc05 in QThread::currentThread () from > /usr/local/lib/qt4/libQtCore.so.4 > #44750 0x28095d21 in QDBusConnectionPrivate::deleteYourself () from > /usr/local/lib/qt4/libQtDBus.so.4 > #44751 0x28089634 in QDBusConnection::~QDBusConnection () from > /usr/local/lib/qt4/libQtDBus.so.4 > #44752 0x0804b800 in __dtor__ZL10connection () > #44753 0x28660417 in __cxa_finalize () from /lib/libc.so.7 > #44754 0x2860747a in exit () from /lib/libc.so.7 > #44755 0x0804c125 in main () > (gdb) This is a bug in qdbus; it uses a global static QDBusConnection object, and the order in which global destructors are called is undefined: http://qt.gitorious.org/qt/qttools/blobs/stable/src/qdbus/qdbus/qdbus.cpp#line57 In this particular case, the destructor (__dtor__ZL10connection) is called *after* all of Qt's internal stuff has already been destroyed: - QDBusConnectionPrivate::deleteYourself() tries to figure out if it is called from the current QThread, and calls QThread::currentThread() - QThread::currentThread() calls QThreadData::current() - QThreadData::current() tries to instantiate a QAdoptedThread - QAdoptedThread descends from QObject, so calls QObject::QObject() - QObject::QObject() calls QThreadData::current() - Endless loop results, until the stack is blown, and a new operator fails in malloc() The global static QDBusConnection object should be replaced by a singleton, as suggested here: http://techbase.kde.org/Policies/Library_Code_Policy#Static_Objects but I am not sure how that is normally done in Qt itself.Received on Fri Dec 07 2012 - 11:59:04 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:33 UTC