Details
Description
When listening for new socket connections the client sockets handed out by QTcpServer will sometimes fail to be initialized.
In file qnativesocketengine_winrt.cpp in function QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState)
A reference to the hr variable is passed into the lambda that is passed to runOnXamlThread. This hr variable is then redeclared a few lines down in the lambda, shadowing it. The hr variable is not initialized before the lambda, not set inside the lambda because it is shadowed, and then checked after the lambda. This is undefined behavior and will randomly succeed or fail.
Attachments
For Gerrit Dashboard: QTBUG-57226 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
177316,3 | qnativesocketengine_winrt - do not shadow a variable | 5.6 | qt/qtbase | Status: MERGED | +2 | 0 |