I've done some investigation on the crash. It's indeed caused by destruction of QApplication
. QNetworkAccessManager
internally uses a QNetworkConfigurationManagerPrivate
object. This object is created when needed and used until the application finishes. The qNetworkConfigurationManagerPrivate
function is used to create or get existing object.
When QApplication
is destroyed, it executes all post routines, including connManager_cleanup
. This function indirectly destroys QNetworkConfigurationManagerPrivate
object and sets appShutdown
local flag. When this flag is set, qNetworkConfigurationManagerPrivate
function will not create new QNetworkConfigurationManagerPrivate
objects anymore. So after destruction of QApplication
QNetworkAccessManager
becomes non-functional.
I thought it's a misuse of QApplication
object, but recently I found a proof link that the use is correct.
Qt's Coding Conventions state:
Q[Core]Application is a singleton class. There can only be one instance at a time. However, that instance can be destroyed and a new one can be created.
So this issue should be considered a Qt bug.