networking: fix UAFs in NMWirelessNetwork ap/setting destroy handler

This commit is contained in:
outfoxxed committed 2026-07-07 00:34:06 -07:00
1 parent a611932352
commit ead3b00afd
2 files changed
+5 -2

No files matched your search

+1
View File
@@ -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.
+4 -2
View File
@@ -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