Skip to content

Commit 8571336

Browse files
authored
ui: wait for lte connection to update before reactivating (#34275)
async
1 parent f149083 commit 8571336

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

selfdrive/ui/qt/network/wifi_manager.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,13 @@ void WifiManager::updateGsmSettings(bool roaming, QString apn, bool metered) {
403403
}
404404

405405
if (changes) {
406-
call(lteConnectionPath.path(), NM_DBUS_INTERFACE_SETTINGS_CONNECTION, "UpdateUnsaved", QVariant::fromValue(settings)); // update is temporary
407-
deactivateConnection(lteConnectionPath);
408-
activateModemConnection(lteConnectionPath);
406+
QDBusPendingCall pending_call = asyncCall(lteConnectionPath.path(), NM_DBUS_INTERFACE_SETTINGS_CONNECTION, "UpdateUnsaved", QVariant::fromValue(settings)); // update is temporary
407+
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending_call);
408+
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, watcher]() {
409+
deactivateConnection(lteConnectionPath);
410+
activateModemConnection(lteConnectionPath);
411+
watcher->deleteLater();
412+
});
409413
}
410414
}
411415
}

0 commit comments

Comments
 (0)