diff --git a/changelog/next.md b/changelog/next.md index f18fe30..0a146fd 100644 --- a/changelog/next.md +++ b/changelog/next.md @@ -8,3 +8,4 @@ - QsWindow.updatesEnabled makes sure windows are redrawn when set to true. - Fixed potential crashes from usage of `WindowsetProjection.screens` during monitor unplug. - Fixed crashes from accessing freed objects laundered through a `ScriptModel`. +- Fixed crashes when a wifi network disappear. diff --git a/src/network/nm/network.cpp b/src/network/nm/network.cpp index 945a438..a3e0ef9 100644 --- a/src/network/nm/network.cpp +++ b/src/network/nm/network.cpp @@ -72,9 +72,10 @@ void NMNetwork::addSettings(NMSettings* settings) { auto onDestroyed = [this, settings]() { if (this->mSettings.take(settings->path())) { - emit this->settingsRemoved(settings); this->updateReferenceSettings(); if (this->mSettings.isEmpty()) this->bKnown = false; + // Deletes `this` + emit this->settingsRemoved(settings); } }; QObject::connect(settings, &NMSettings::destroyed, this, onDestroyed); @@ -240,8 +241,9 @@ void NMWirelessNetwork::addAccessPoint(NMAccessPoint* ap) { this->mAccessPoints.insert(ap->path(), ap); auto onDestroyed = [this, ap]() { if (this->mAccessPoints.take(ap->path())) { - emit this->apRemoved(ap); this->updateReferenceAp(); + // Deletes `this` + emit this->apRemoved(ap); } }; // clang-format off