Re: problems with threads/destructors in -current with llvm/clan

看板FB_current作者時間12年前 (2013/04/27 12:33), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/12 (看更多)
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. _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
文章代碼(AID): #1HUrK6m1 (FB_current)
討論串 (同標題文章)
完整討論串 (本文為第 1 之 12 篇):
文章代碼(AID): #1HUrK6m1 (FB_current)