Prevent tdenetworkmanager from crashing when using unmanaged devices.

This relates to bug 2929.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/76/head
Michele Calgaro 5 years ago
parent 30606e55f1
commit 3192a72a46
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -1156,16 +1156,16 @@ TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString d
return (*it);
}
}
return "";
return TQString::null;
}
else {
// Error!
PRINT_ERROR((error.name() + ": " + error.message()))
return "";
return TQString::null;
}
}
else {
return "";
return TQString::null;
}
}
@ -1249,7 +1249,7 @@ TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TDE
d->m_vpnProxy->setConnection(TQT_DBusConnection::systemBus());
d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
if (d->m_dbusDeviceString != "") {
if (!d->m_dbusDeviceString.isEmpty()) {
d->m_networkDeviceProxy = new DBus::DeviceProxy(NM_DBUS_SERVICE, d->m_dbusDeviceString);
d->m_networkDeviceProxy->setConnection(TQT_DBusConnection::systemBus());
if (deviceType() == TDENetworkDeviceType::WiFi) {
@ -1567,11 +1567,11 @@ TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM
if (!m_networkDevice) {
return TDENetworkDeviceType::BackendOnly;
}
else {
if (d->m_dbusDeviceString != "") {
// Query NM for the device type
TQT_DBusError error;
d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
if (!d->m_dbusDeviceString.isEmpty()) {
DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
genericDevice.setConnection(TQT_DBusConnection::systemBus());
TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error));
@ -1586,11 +1586,10 @@ TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM
}
else {
// Error!
PRINT_ERROR(TQString("Invalid DBUS device string '%1'").arg(d->m_dbusDeviceString))
PRINT_ERROR(TQString("Invalid empty DBUS device string"))
return TDENetworkDeviceType::Other;
}
}
}
TDENetworkConnectionType::TDENetworkConnectionType TDENetworkConnectionManager_BackendNM::connectionType(TQString dbusPath) {
TDENetworkConnectionType::TDENetworkConnectionType connType = TDENetworkConnectionType::Other;
@ -4791,6 +4790,10 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
else {
d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
}
if (d->m_dbusDeviceString.isEmpty()) {
PRINT_ERROR(TQString("Invalid empty DBUS device string"))
return TDENetworkConnectionStatus::Invalid;
}
#ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS
TQT_DBusObjectPath active_connection;
ret = d->m_networkManagerProxy->ActivateConnection(existingConnection, TQT_DBusObjectPath(d->m_dbusDeviceString.ascii()), TQT_DBusObjectPath("/"), active_connection, error);
@ -4984,6 +4987,10 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
else {
d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
}
if (d->m_dbusDeviceString.isEmpty()) {
PRINT_ERROR(TQString("Invalid empty DBUS device string"))
return TDENetworkConnectionStatus::Invalid;
}
#ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS
ret = d->m_networkManagerProxy->DeactivateConnection(existingConnection, error);
if (ret && error.isValid()) {
@ -5270,6 +5277,7 @@ TDENetworkHWNeighborList* TDENetworkConnectionManager_BackendNM::siteSurvey() {
clearTDENetworkHWNeighborList();
if (myDeviceType == TDENetworkDeviceType::WiFi) {
if (!d->m_dbusDeviceString.isEmpty()) {
DBus::WiFiDeviceProxy wiFiDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
wiFiDevice.setConnection(TQT_DBusConnection::systemBus());
// FIXME
@ -5288,6 +5296,7 @@ TDENetworkHWNeighborList* TDENetworkConnectionManager_BackendNM::siteSurvey() {
}
}
}
}
return m_hwNeighborList;
}

Loading…
Cancel
Save