Commit 916f0081 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

actually erase devices

somebody forgot to actually erase 😞

this would eventually result in a crash as the container would have
dangling pointers as remove only moves around the entries so the
container would be the same size before and after remove but one of the
pointers would then get deleted in the eventloop

BUG: 428746
FIXED-IN: 5.20.3

(cherry picked from commit fd099a75)
parent eccae88b
......@@ -85,6 +85,12 @@ private Q_SLOTS:
// Ensure removing works as well.
QCOMPARE(monitor.devices().size(), 1);
......@@ -51,7 +51,7 @@ void SMARTMonitor::checkUDI(const QString &udi)
void SMARTMonitor::removeUDI(const QString &udi)
std::remove_if(m_devices.begin(), m_devices.end(), [this, udi](Device *dev) {
auto newEnd = std::remove_if(m_devices.begin(), m_devices.end(), [this, udi](Device *dev) {
if (dev->udi() != udi) {
return false;
......@@ -60,6 +60,7 @@ void SMARTMonitor::removeUDI(const QString &udi)
return true;
m_devices.erase(newEnd, m_devices.end());
void SMARTMonitor::reloadData()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment