BlackBerry: Prevent superfluous removal of socket notifiers
File descriptors have always been removed from bps before adding them, which lead to an annoying warning. "QEventDispatcherUNIX::registerSocketNotifier()" needs to be called after "ioEvents()" to prevent this. Task-number: QTBUG-34536 Change-Id: If074ff7a6638fe234abc100c81d094e182de7537 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
This commit is contained in:
parent
215e525a5c
commit
e9c51a1fdc
@ -237,9 +237,6 @@ void QEventDispatcherBlackberry::registerSocketNotifier(QSocketNotifier *notifie
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the base Unix implementation. Needed to allow select() to be called correctly
|
|
||||||
QEventDispatcherUNIX::registerSocketNotifier(notifier);
|
|
||||||
|
|
||||||
// Register the fd with bps
|
// Register the fd with bps
|
||||||
BpsChannelScopeSwitcher channelSwitcher(d->bps_channel);
|
BpsChannelScopeSwitcher channelSwitcher(d->bps_channel);
|
||||||
int io_events = ioEvents(sockfd);
|
int io_events = ioEvents(sockfd);
|
||||||
@ -265,6 +262,9 @@ void QEventDispatcherBlackberry::registerSocketNotifier(QSocketNotifier *notifie
|
|||||||
const int result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data());
|
const int result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data());
|
||||||
if (Q_UNLIKELY(result != BPS_SUCCESS))
|
if (Q_UNLIKELY(result != BPS_SUCCESS))
|
||||||
qWarning() << "QEventDispatcherBlackberry: bps_add_fd failed";
|
qWarning() << "QEventDispatcherBlackberry: bps_add_fd failed";
|
||||||
|
|
||||||
|
// Call the base Unix implementation. Needed to allow select() to be called correctly
|
||||||
|
QEventDispatcherUNIX::registerSocketNotifier(notifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notifier)
|
void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notifier)
|
||||||
@ -280,23 +280,22 @@ void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notif
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow the base Unix implementation to unregister the fd too
|
// Allow the base Unix implementation to unregister the fd too (before call to ioEvents()!)
|
||||||
QEventDispatcherUNIX::unregisterSocketNotifier(notifier);
|
QEventDispatcherUNIX::unregisterSocketNotifier(notifier);
|
||||||
|
|
||||||
// Unregister the fd with bps
|
// Unregister the fd with bps
|
||||||
BpsChannelScopeSwitcher channelSwitcher(d->bps_channel);
|
BpsChannelScopeSwitcher channelSwitcher(d->bps_channel);
|
||||||
const int io_events = ioEvents(sockfd);
|
|
||||||
int result = bps_remove_fd(sockfd);
|
int result = bps_remove_fd(sockfd);
|
||||||
if (Q_UNLIKELY(result != BPS_SUCCESS))
|
if (Q_UNLIKELY(result != BPS_SUCCESS))
|
||||||
qWarning() << "QEventDispatcherBlackberry: bps_remove_fd failed" << sockfd;
|
qWarning() << "QEventDispatcherBlackberry: bps_remove_fd failed" << sockfd;
|
||||||
|
|
||||||
// if no other socket notifier is watching sockfd, our job ends here
|
const int io_events = ioEvents(sockfd);
|
||||||
if (!io_events)
|
// if other socket notifier is watching sockfd, readd it
|
||||||
return;
|
if (io_events) {
|
||||||
|
result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data());
|
||||||
result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data());
|
if (Q_UNLIKELY(result != BPS_SUCCESS))
|
||||||
if (Q_UNLIKELY(result != BPS_SUCCESS))
|
qWarning("QEventDispatcherBlackberry: bps_add_fd error");
|
||||||
qWarning("QEventDispatcherBlackberry: bps_add_fd error");
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int timespecToMillisecs(const timespec &tv)
|
static inline int timespecToMillisecs(const timespec &tv)
|
||||||
|
Loading…
Reference in New Issue
Block a user