Prevent Cantata from potentially crashing when closing

Directly deleting DevicePrivate members from within the destructor of
DeviceManagerPrivate can lead to a crash in Qt's internal memory management.
Better defer destruction by using deleteLater() like it has already been done
in DevicePrivate::setBackendObject().
This commit is contained in:
Thomas Uhle
2020-04-08 12:30:12 +02:00
parent efa907c8e0
commit 01d214f60e
2 changed files with 4 additions and 2 deletions

View File

@@ -59,9 +59,9 @@ Solid::DeviceManagerPrivate::~DeviceManagerPrivate()
disconnect(backend, nullptr, this, nullptr);
}
for (QtPointer<DevicePrivate> dev: m_devicesMap) {
for (QtPointer<DevicePrivate> &dev: m_devicesMap) {
if (dev.data() && !dev.data()->ref.deref()) {
delete dev.data();
dev.data()->deleteLater();
}
}