Fix the problem with QNetworkAccessManager getting stuck in NotAccessible state
It appears that QNetworkAccessManager
can keep receiving queued signals even after it has cleared its reference to QNetworkSession
and disconnected the slots. That can mess up networkAccessible
state. Particularly, QNetworkAccessManager
can get stuck in NotAccessible
state and refuse to submit new network requests until the next online state change signal pulls it out of this state.
There still may be a possibility that a signal from an old QNetworkSession
could arrive when QNetworkAccessManager
has already switched to another QNetworkSession
, but this scenario is probably broken by design, since for whatever reason QNetworkAccessManager
is only tracking one QNetworkSession
. In any case, it's far less likely than the scenario which I was trying to fix.