QSignalSpy: de-inline most of the private ctor
... by moving its body into an out-of-line init() function. This allows to drop the exporting of connectToSignal(). We can't de-inline the whole ctor (yet), because that would pin the vtable to the qsignalspy.cpp TU, which would require us to export the class wholesale to make the vtable accessible to users of the class, but we can't export the class because it inherits QList. Task-number: QTBUG-123544 Change-Id: Ieffd6d2f542daa20e876c6114cb5dc8150870bb4 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>bb10
parent
9ecb468aec
commit
51e0a33a54
|
|
@ -244,6 +244,17 @@ QList<int> QSignalSpy::makeArgs(const QMetaMethod &member, const QObject *obj)
|
|||
return result;
|
||||
}
|
||||
|
||||
void QSignalSpy::init(ObjectSignal os)
|
||||
{
|
||||
if (!os.obj)
|
||||
return;
|
||||
|
||||
if (!connectToSignal(os.obj, os.sig.methodIndex()))
|
||||
return;
|
||||
|
||||
sig = os.sig.methodSignature();
|
||||
}
|
||||
|
||||
bool QSignalSpy::connectToSignal(const QObject *sender, int sigIndex)
|
||||
{
|
||||
static const int memberOffset = QObject::staticMetaObject.methodCount();
|
||||
|
|
|
|||
|
|
@ -65,20 +65,14 @@ private:
|
|||
explicit QSignalSpy(ObjectSignal os)
|
||||
: args(os.obj ? makeArgs(os.sig, os.obj) : QList<int>{})
|
||||
{
|
||||
if (!os.obj)
|
||||
return;
|
||||
|
||||
if (!connectToSignal(os.obj, os.sig.methodIndex()))
|
||||
return;
|
||||
|
||||
sig = os.sig.methodSignature();
|
||||
init(os);
|
||||
}
|
||||
|
||||
Q_TESTLIB_EXPORT void init(ObjectSignal os);
|
||||
|
||||
Q_TESTLIB_EXPORT static ObjectSignal verify(const QObject *obj, QMetaMethod signal);
|
||||
Q_TESTLIB_EXPORT static ObjectSignal verify(const QObject *obj, const char *aSignal);
|
||||
|
||||
Q_TESTLIB_EXPORT bool connectToSignal(const QObject *sender, int sigIndex);
|
||||
bool connectToSignal(const QObject *sender, int sigIndex);
|
||||
|
||||
Q_TESTLIB_EXPORT static QList<int> makeArgs(const QMetaMethod &member, const QObject *obj);
|
||||
Q_TESTLIB_EXPORT void appendArgs(void **a);
|
||||
|
|
|
|||
Loading…
Reference in New Issue