summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-05-07 11:44:37 +0200
committerLiang Qi <liang.qi@qt.io>2019-05-07 11:58:30 +0200
commitc2b553784dfbe0ece90f79709639e27e74359a7d (patch)
tree04b0c74c7417a5f1b628d0b18a07f9dd8be1df60 /src/corelib/kernel
parent0b373c2e36a68aedf3731fcb3cd84fd010c2d67c (diff)
parent8ea0a82a6a771dd76df2d51c6ef3ed966a5b9b45 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: src/corelib/kernel/qobject.cpp src/corelib/kernel/qvariant.h src/corelib/tools/qlist.h Done-With: Milian Wolff <milian.wolff@kdab.com> Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: I6803f7239aa137a51a7467fab7cc7a01302a848d
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp22
-rw-r--r--src/corelib/kernel/qobject.cpp46
-rw-r--r--src/corelib/kernel/qsignalmapper.cpp4
-rw-r--r--src/corelib/kernel/qvariant.h5
4 files changed, 45 insertions, 32 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index d9fdb7f785..7a6faf2e2b 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -999,6 +999,7 @@ void QCoreApplication::setQuitLockEnabled(bool enabled)
quitLockRefEnabled = enabled;
}
+#if QT_DEPRECATED_SINCE(5, 6)
/*!
\internal
\deprecated
@@ -1010,6 +1011,7 @@ bool QCoreApplication::notifyInternal(QObject *receiver, QEvent *event)
{
return notifyInternal2(receiver, event);
}
+#endif
/*!
\internal
@@ -1183,28 +1185,26 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event)
{
// Note: when adjusting the tracepoints in here
// consider adjusting QApplicationPrivate::notify_helper too.
- Q_TRACE_SCOPE(QCoreApplication_notify, receiver, event, event->type());
+ Q_TRACE(QCoreApplication_notify_entry, receiver, event, event->type());
+ bool consumed = false;
+ bool filtered = false;
+ Q_TRACE_EXIT(QCoreApplication_notify_exit, consumed, filtered);
// send to all application event filters (only does anything in the main thread)
if (QCoreApplication::self
&& receiver->d_func()->threadData->thread == mainThread()
&& QCoreApplication::self->d_func()->sendThroughApplicationEventFilters(receiver, event)) {
- Q_TRACE(QCoreApplication_notify_event_filtered, receiver, event, event->type());
- return true;
+ filtered = true;
+ return filtered;
}
// send to all receiver event filters
if (sendThroughObjectEventFilters(receiver, event)) {
- Q_TRACE(QCoreApplication_notify_event_filtered, receiver, event, event->type());
- return true;
+ filtered = true;
+ return filtered;
}
- Q_TRACE(QCoreApplication_notify_before_delivery, receiver, event, event->type());
-
// deliver the event
- const bool consumed = receiver->event(event);
-
- Q_TRACE(QCoreApplication_notify_after_delivery, receiver, event, event->type(), consumed);
-
+ consumed = receiver->event(event);
return consumed;
}
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index eaf35adb90..b034455cc1 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1457,8 +1457,9 @@ QThread *QObject::thread() const
\snippet code/src_corelib_kernel_qobject.cpp 7
- If \a targetThread is zero, all event processing for this object
- and its children stops.
+ If \a targetThread is \nullptr, all event processing for this object
+ and its children stops, as they are no longer associated with any
+ thread.
Note that all active timers for the object will be reset. The
timers are first stopped in the current thread and restarted (with
@@ -1469,13 +1470,18 @@ QThread *QObject::thread() const
A QEvent::ThreadChange event is sent to this object just before
the thread affinity is changed. You can handle this event to
perform any special processing. Note that any new events that are
- posted to this object will be handled in the \a targetThread.
+ posted to this object will be handled in the \a targetThread,
+ provided it is non-null: when it is \nullptr, no event processing
+ for this object or its children can happen, as they are no longer
+ associated with any thread.
\warning This function is \e not thread-safe; the current thread
must be same as the current thread affinity. In other words, this
function can only "push" an object from the current thread to
another thread, it cannot "pull" an object from any arbitrary
- thread to the current thread.
+ thread to the current thread. There is one exception to this rule
+ however: objects with no thread affinity can be "pulled" to the
+ current thread.
\sa thread()
*/
@@ -3653,12 +3659,13 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (sp->blockSig)
return;
+ Q_TRACE_SCOPE(QMetaObject_activate, sender, signal_index);
+
if (sp->isDeclarativeSignalConnected(signal_index)
&& QAbstractDeclarativeData::signalEmitted) {
- Q_TRACE(QMetaObject_activate_begin_declarative_signal, sender, signal_index);
+ Q_TRACE_SCOPE(QMetaObject_activate_declarative_signal, sender, signal_index);
QAbstractDeclarativeData::signalEmitted(sp->declarativeData, sender,
signal_index, argv);
- Q_TRACE(QMetaObject_activate_end_declarative_signal, sender, signal_index);
}
const QSignalSpyCallbackSet *signal_spy_set = callbacks_enabled ? qt_signal_spy_callback_set.load() : nullptr;
@@ -3671,8 +3678,6 @@ void doActivate(QObject *sender, int signal_index, void **argv)
// The possible declarative connection is done, and nothing else is connected
if (callbacks_enabled && signal_spy_set->signal_begin_callback != nullptr)
signal_spy_set->signal_begin_callback(sender, signal_index, argv);
- Q_TRACE(QMetaObject_activate_begin_signal, sender, signal_index);
- Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index);
if (callbacks_enabled && signal_spy_set->signal_end_callback != nullptr)
signal_spy_set->signal_end_callback(sender, signal_index);
return;
@@ -3680,7 +3685,6 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (callbacks_enabled && signal_spy_set->signal_begin_callback != nullptr)
signal_spy_set->signal_begin_callback(sender, signal_index, argv);
- Q_TRACE(QMetaObject_activate_begin_signal, sender, signal_index);
bool senderDeleted = false;
{
@@ -3758,9 +3762,11 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (c->isSlotObject) {
c->slotObj->ref();
QScopedPointer<QtPrivate::QSlotObjectBase, QSlotObjectBaseDeleter> obj(c->slotObj);
- Q_TRACE(QMetaObject_activate_begin_slot_functor, obj.data());
- obj->call(receiver, argv);
- Q_TRACE(QMetaObject_activate_end_slot_functor, obj.data());
+
+ {
+ Q_TRACE_SCOPE(QMetaObject_activate_slot_functor, obj.data());
+ obj->call(receiver, argv);
+ }
} else if (c->callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) {
//we compare the vtable to make sure we are not in the destructor of the object.
const int method_relative = c->method_relative;
@@ -3768,11 +3774,12 @@ void doActivate(QObject *sender, int signal_index, void **argv)
const int methodIndex = (Q_HAS_TRACEPOINTS || callbacks_enabled) ? c->method() : 0;
if (callbacks_enabled && signal_spy_set->slot_begin_callback != nullptr)
signal_spy_set->slot_begin_callback(receiver, methodIndex, argv);
- Q_TRACE(QMetaObject_activate_begin_slot, receiver, methodIndex);
- callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv);
+ {
+ Q_TRACE_SCOPE(QMetaObject_activate_slot, receiver, methodIndex);
+ callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv);
+ }
- Q_TRACE(QMetaObject_activate_end_slot, receiver, methodIndex);
if (callbacks_enabled && signal_spy_set->slot_end_callback != nullptr)
signal_spy_set->slot_end_callback(receiver, methodIndex);
} else {
@@ -3781,11 +3788,12 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (callbacks_enabled && signal_spy_set->slot_begin_callback != nullptr) {
signal_spy_set->slot_begin_callback(receiver, method, argv);
}
- Q_TRACE(QMetaObject_activate_begin_slot, receiver, method);
- QMetaObject::metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv);
+ {
+ Q_TRACE_SCOPE(QMetaObject_activate_slot, receiver, method);
+ QMetaObject::metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv);
+ }
- Q_TRACE(QMetaObject_activate_end_slot, receiver, method);
if (callbacks_enabled && signal_spy_set->slot_end_callback != nullptr)
signal_spy_set->slot_end_callback(receiver, method);
}
@@ -3803,8 +3811,6 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (callbacks_enabled && signal_spy_set->signal_end_callback != nullptr)
signal_spy_set->signal_end_callback(sender, signal_index);
- Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index);
-
}
/*!
diff --git a/src/corelib/kernel/qsignalmapper.cpp b/src/corelib/kernel/qsignalmapper.cpp
index 02a1281f92..34fea861cd 100644
--- a/src/corelib/kernel/qsignalmapper.cpp
+++ b/src/corelib/kernel/qsignalmapper.cpp
@@ -37,6 +37,9 @@
**
****************************************************************************/
+#include "qglobal.h"
+#if QT_DEPRECATED_SINCE(5, 10)
+
#include "qsignalmapper.h"
#include "qhash.h"
#include "qobject_p.h"
@@ -312,3 +315,4 @@ QT_END_NAMESPACE
#include "moc_qsignalmapper.cpp"
+#endif
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 924cfa1e1a..e094ebff52 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -393,10 +393,13 @@ class Q_CORE_EXPORT QVariant
: type(variantType), is_shared(false), is_null(false)
{}
- inline Private(const Private &other) noexcept
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ Private(const Private &other) noexcept
: data(other.data), type(other.type),
is_shared(other.is_shared), is_null(other.is_null)
{}
+ Private &operator=(const Private &other) noexcept = default;
+#endif
union Data
{
char c;