Skip to content

Commit

Permalink
[libconnman-qt] Fix crash on connman restart. Contributes to JB#52659
Browse files Browse the repository at this point in the history
When the service is disconnected clear the currentWifi pointer as the
service it points to will subsequently be deleted leading to a crash if
it is accessed later.
  • Loading branch information
adenexter committed Jan 12, 2021
1 parent 6024bd6 commit 1b4d474
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion libconnman-qt/networkmanager.cpp
Expand Up @@ -451,9 +451,16 @@ void NetworkManager::disconnectServices()
bool wasValid = isValid();
m_priv->setServicesAvailable(false);

bool emitDefaultRouteChanged = false;
if (m_defaultRoute != m_invalidDefaultRoute) {
m_defaultRoute = m_invalidDefaultRoute;
Q_EMIT defaultRouteChanged(m_defaultRoute);
emitDefaultRouteChanged = true;
}

bool emitConnectedWifiChanged = false;
if (m_priv->m_connectedWifi) {
m_priv->m_connectedWifi = NULL;
emitConnectedWifiChanged = true;
}

if (m_proxy) {
Expand Down Expand Up @@ -498,6 +505,14 @@ void NetworkManager::disconnectServices()
Q_EMIT servicesChanged();
}

if (emitDefaultRouteChanged) {
Q_EMIT defaultRouteChanged(m_defaultRoute);
}

if (emitConnectedWifiChanged) {
Q_EMIT connectedWifiChanged();
}

if (emitSavedServicesChanged) {
Q_EMIT savedServicesChanged();
}
Expand Down

0 comments on commit 1b4d474

Please sign in to comment.