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>
This commit is contained in:
parent
81ed78c293
commit
0e8b626401
@ -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)) {
|
||||
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;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QObject::event(e);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
Reference in New Issue
Block a user