I recently got some errors of kind "<error message> (Operation succeeded)" after calling QTimer::singleShot. After inspecting Qt source code to find out more about the issue, I realized that there was a bug in the qErrnoWarning function: when it calls GetLastError(), it always gets 0 while it should have retrieved a valid system error code; and it happens only if its msg argument is not an empty string.
This is probably caused by QString::vasprintf calling some system function internally, which succeeds and then clears the last error code. An easy fix would be to call qt_error_string (which calls GetLastError) before the call to QString::vasprintf.
Here is some code that demonstrates the problem:
Output (translated from french, so may be inaccurate):
I'm sorry if this bug is already fixed in more recent versions of Qt, I cannot test with the latest.
|For Gerrit Dashboard: QTBUG-77322|
|269597,2||Fix qErrnoWarning() printing no error in some conditions||5.12||qt/qtbase||Status: MERGED||+2||0|