QThread: simplify the pthread_cleanup_pop function
Make sure that the QString is not in scope anymore when the pthread cleanup happens. C++ destructors in scope are pthread cleanup handlers. Change-Id: I9a75ad8521ae4e5cbbe5ffff13d1ae1c7e31f6bb Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
73991bee38
commit
827f934760
@ -313,14 +313,15 @@ void *QThreadPrivate::start(void *arg)
|
|||||||
createEventDispatcher(data);
|
createEventDispatcher(data);
|
||||||
|
|
||||||
#if (defined(Q_OS_LINUX) || defined(Q_OS_MAC) || defined(Q_OS_QNX))
|
#if (defined(Q_OS_LINUX) || defined(Q_OS_MAC) || defined(Q_OS_QNX))
|
||||||
// sets the name of the current thread.
|
{
|
||||||
QString objectName = thr->objectName();
|
// sets the name of the current thread.
|
||||||
|
QString objectName = thr->objectName();
|
||||||
if (Q_LIKELY(objectName.isEmpty()))
|
|
||||||
setCurrentThreadName(thr->d_func()->thread_id, thr->metaObject()->className());
|
|
||||||
else
|
|
||||||
setCurrentThreadName(thr->d_func()->thread_id, objectName.toLocal8Bit());
|
|
||||||
|
|
||||||
|
if (Q_LIKELY(objectName.isEmpty()))
|
||||||
|
setCurrentThreadName(thr->d_func()->thread_id, thr->metaObject()->className());
|
||||||
|
else
|
||||||
|
setCurrentThreadName(thr->d_func()->thread_id, objectName.toLocal8Bit());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
emit thr->started(QThread::QPrivateSignal());
|
emit thr->started(QThread::QPrivateSignal());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user