summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2020-12-11 13:15:47 +0200
committerAlex Trotsenko <alex1973tr@gmail.com>2020-12-11 14:48:45 +0200
commit0e8b62640103f3dc105f4c58ce3b7e1af90a4d1d (patch)
tree05668452421b565ca5bc03d86ab25f9cf712e6ef /src
parent81ed78c2936d569daa85bf5dcface076a36d6f2b (diff)
Fix event() chaining in QSocketNotifier
We should return the result of the call of the base implementation for all events that we did not handle. Also, QObject::event() does not actually activate any filters, so the comment was inaccurate as well. Change-Id: Iff6644b7b1621229f8351c83569ee72594e47197 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qsocketnotifier.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/corelib/kernel/qsocketnotifier.cpp b/src/corelib/kernel/qsocketnotifier.cpp
index 6e1d2103bd..934727a6ba 100644
--- a/src/corelib/kernel/qsocketnotifier.cpp
+++ b/src/corelib/kernel/qsocketnotifier.cpp
@@ -289,24 +289,28 @@ bool QSocketNotifier::event(QEvent *e)
Q_D(QSocketNotifier);
// Emits the activated() signal when a QEvent::SockAct or QEvent::SockClose is
// received.
- if (e->type() == QEvent::ThreadChange) {
+ switch (e->type()) {
+ case QEvent::ThreadChange:
if (d->snenabled) {
QMetaObject::invokeMethod(this, "setEnabled", Qt::QueuedConnection,
Q_ARG(bool, d->snenabled));
setEnabled(false);
}
- }
- QObject::event(e); // will activate filters
- if ((e->type() == QEvent::SockAct) || (e->type() == QEvent::SockClose)) {
- QPointer<QSocketNotifier> alive(this);
- emit activated(d->sockfd, d->sntype, QPrivateSignal());
- // ### Qt7: Remove emission if the activated(int) signal is removed
- if (alive)
- emit activated(int(qintptr(d->sockfd)), QPrivateSignal());
-
+ break;
+ case QEvent::SockAct:
+ case QEvent::SockClose:
+ {
+ QPointer<QSocketNotifier> alive(this);
+ emit activated(d->sockfd, d->sntype, QPrivateSignal());
+ // ### Qt7: Remove emission if the activated(int) signal is removed
+ if (alive)
+ emit activated(int(qintptr(d->sockfd)), QPrivateSignal());
+ }
return true;
+ default:
+ break;
}
- return false;
+ return QObject::event(e);
}
/*!