backends/drm: fix output changes with the placeholder output

As the placeholder output gets added or removed in response to other outputs
getting enabled or disabled, the output list may change while iterating over
them and applying changes.

BUG: 448454
BUG: 448474
CCBUG: 448697
FIXED-IN: 5.24
This commit is contained in:
Xaver Hugl 2022-01-18 21:36:23 +00:00 committed by Nate Graham
parent 2cf6fc82c4
commit e0a8fa778e

View file

@ -632,10 +632,14 @@ bool DrmBackend::applyOutputChanges(const WaylandOutputConfig &config)
return false;
}
}
// first, apply changes to drm outputs.
// This may remove the placeholder output and thus change m_outputs!
for (const auto &output : qAsConst(changed)) {
output->applyQueuedChanges(config);
}
// only then apply changes to the virtual outputs
for (const auto &output : qAsConst(m_outputs)) {
if (auto drmOutput = qobject_cast<DrmOutput*>(output)) {
drmOutput->applyQueuedChanges(config);
} else {
if (!qobject_cast<DrmOutput*>(output)) {
output->applyChanges(config);
}
};