[Qt-interest] sslError slot triggered when handling sslError with an event loop
Eric Miller
ericm at sifteo.com
Tue Mar 8 18:29:13 CET 2011
Hi -
We're handling QNetworkAccessManager's sslError signal by posing a dialog for the user. This appears to be the recommended way to handle ssl errors, as ignoreSslErrors must be called from this slot.
I've found that while our dialog is posed, the very same network reply appears to be triggered again and percolates up through the dialog's event loop such that our onSslError slot is triggered again while still handling the first call. An abbreviated tour of the callstack looks like this, from bottom to top:
main
QCoreApplication::exec // bottom app run-loop
...
__CFRunLoopRun
__CFRunLoopDoSources0
__CFSocketPerformV0
__CFSocketDoCallback
...
QAbstractSocketPrivate::canReadNotification // first time the socket is being read here
QIODevice::readyRead
...
QSslSocket::sslErrors // first trigger of ssl errors on this request
...
OurNetworkAccessManager::execSSLErrorDialog // here we pose our modal dialog
...
__CFRunLoopRun // dialog's run loop
__CFRunLoopDoSources0
__CFSocketPerformV0
__CFSocketDoCallback
...
QAbstractSocketPrivate::canReadNotification // socket callback being triggered a second time on same callstack
QIODevice::readyRead
...
QSslSocket::sslErrors // ssl errors triggered again
...
OurNetworkAccessManager::execSSLErrorDialog // pose our dialog again ...
This can happen more than once, and the call stack grows each time it does. If we naively pose a dialog in response to an SSL error, we wind up posing multiple dialogs for the same QNetworkReply.
I am still trying to characterize the issue, but I wanted to throw this out there to see if anyone has seen such a thing.
thanks,
Eric Miller
More information about the Qt-interest-old
mailing list