QNetworkInformation(Win): cleanup dtor
I don't like how it looks, so make stop() work even if it's not monitoring so that the dtor can call it unconditionally, and without needing a CoUninitialize call of its own. Change-Id: I06832d7e1d34317ff49ea2c425c79588719d7cd0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
62efc8990d
commit
7ddf834b86
@ -305,10 +305,7 @@ QNetworkListManagerNetworkInformationBackend::~QNetworkListManagerNetworkInforma
|
|||||||
{
|
{
|
||||||
if (comInitFailed)
|
if (comInitFailed)
|
||||||
return;
|
return;
|
||||||
if (monitoring)
|
stop();
|
||||||
stop();
|
|
||||||
else
|
|
||||||
CoUninitialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QNetworkListManagerNetworkInformationBackend::setConnectivity(NLM_CONNECTIVITY newConnectivity)
|
void QNetworkListManagerNetworkInformationBackend::setConnectivity(NLM_CONNECTIVITY newConnectivity)
|
||||||
@ -354,12 +351,13 @@ bool QNetworkListManagerNetworkInformationBackend::start()
|
|||||||
|
|
||||||
void QNetworkListManagerNetworkInformationBackend::stop()
|
void QNetworkListManagerNetworkInformationBackend::stop()
|
||||||
{
|
{
|
||||||
Q_ASSERT(managerEvents);
|
if (monitoring) {
|
||||||
Q_ASSERT(monitoring);
|
Q_ASSERT(managerEvents);
|
||||||
// Can return false but realistically shouldn't since that would break everything:
|
// Can return false but realistically shouldn't since that would break everything:
|
||||||
managerEvents->stop();
|
managerEvents->stop();
|
||||||
monitoring = false;
|
monitoring = false;
|
||||||
managerEvents.Reset();
|
managerEvents.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
comInitFailed = true; // we check this value in start() to see if we need to re-initialize
|
comInitFailed = true; // we check this value in start() to see if we need to re-initialize
|
||||||
|
Loading…
Reference in New Issue
Block a user