Commit 3692ff7c authored by David Edmundson's avatar David Edmundson Committed by Nate Graham
Browse files

Avoid crash in plasma-session teardown

Whilst iterating through m_proccesses we make them finish. An existing
connect removes them from the vector.

Iterating through a volatile vector is unsafe.

BUG: 454159
parent 2d1107ee
Pipeline #195427 passed with stage
in 6 minutes and 23 seconds
......@@ -37,7 +37,10 @@ SessionTrack::~SessionTrack()
for (auto process : std::as_const(m_processes)) {
process->terminate();
}
for (auto process : std::as_const(m_processes)) {
// copy before the loop as we remove finished processes from the vector
const QVector<QProcess *> processesCopy = m_processes;
for (auto process : processesCopy) {
if (process->state() == QProcess::Running && !process->waitForFinished(500)) {
process->kill();
} else {
......
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