summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r--src/corelib/kernel/qobject.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 8e4ec7c..389e6e7 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3279,12 +3279,14 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
const int method = c->method;
QObjectPrivate::Sender currentSender;
- currentSender.sender = sender;
- currentSender.signal = signal_absolute_index;
- currentSender.ref = 1;
+ const bool receiverInSameThread = currentThreadData == receiver->d_func()->threadData;
QObjectPrivate::Sender *previousSender = 0;
- if (currentThreadData == receiver->d_func()->threadData)
+ if (receiverInSameThread) {
+ currentSender.sender = sender;
+ currentSender.signal = signal_absolute_index;
+ currentSender.ref = 1;
previousSender = QObjectPrivate::setCurrentSender(receiver, &currentSender);
+ }
locker.unlock();
if (qt_signal_spy_callback_set.slot_begin_callback != 0) {
@@ -3300,8 +3302,8 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv);
} QT_CATCH(...) {
locker.relock();
-
- QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
+ if (receiverInSameThread)
+ QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
--connectionLists->inUse;
Q_ASSERT(connectionLists->inUse >= 0);
@@ -3316,7 +3318,8 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
locker.relock();
- QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
+ if (receiverInSameThread)
+ QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
if (connectionLists->orphaned)
break;