QAdoptedThread: bypass signal notification on an un-observable QObject
We've just created the object (we're still inside the constructor). No one can have connected to the signals yet. Change-Id: I1f499b3fc6d2089665bdfffda709e1efaa2c4865 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
parent
f2b5c779cd
commit
43a27888b4
@ -1288,6 +1288,17 @@ QString QObject::objectName() const
|
|||||||
return d->extraData ? d->extraData->objectName : QString();
|
return d->extraData ? d->extraData->objectName : QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
Only use if you know nothing can be bound yet. Usually used for
|
||||||
|
internal objects that do get names.
|
||||||
|
*/
|
||||||
|
void QObjectPrivate::setObjectNameWithoutBindings(const QString &name)
|
||||||
|
{
|
||||||
|
ensureExtraData();
|
||||||
|
extraData->objectName.setValueBypassingBindings(name);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void QObject::setObjectName(const QString &name)
|
\fn void QObject::setObjectName(const QString &name)
|
||||||
Sets the object's name to \a name.
|
Sets the object's name to \a name.
|
||||||
|
@ -104,6 +104,7 @@ public:
|
|||||||
if (!extraData)
|
if (!extraData)
|
||||||
extraData = new ExtraData(this);
|
extraData = new ExtraData(this);
|
||||||
}
|
}
|
||||||
|
void setObjectNameWithoutBindings(const QString &name);
|
||||||
|
|
||||||
typedef void (*StaticMetaCallFunction)(QObject *, QMetaObject::Call, int, void **);
|
typedef void (*StaticMetaCallFunction)(QObject *, QMetaObject::Call, int, void **);
|
||||||
struct Connection;
|
struct Connection;
|
||||||
|
@ -126,7 +126,9 @@ QAdoptedThread::QAdoptedThread(QThreadData *data)
|
|||||||
// we are the main thread
|
// we are the main thread
|
||||||
QCoreApplicationPrivate::theMainThread.storeRelease(this);
|
QCoreApplicationPrivate::theMainThread.storeRelease(this);
|
||||||
QCoreApplicationPrivate::theMainThreadId.storeRelaxed(id);
|
QCoreApplicationPrivate::theMainThreadId.storeRelaxed(id);
|
||||||
setObjectName(u"Qt mainThread"_s);
|
|
||||||
|
// bypass the bindings because nothing can be listening yet
|
||||||
|
d_func()->setObjectNameWithoutBindings(u"Qt mainThread"_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
// thread should be running and not finished for the lifetime
|
// thread should be running and not finished for the lifetime
|
||||||
|
Loading…
x
Reference in New Issue
Block a user