[plasma/kwin] src/backends/drm: drm: don't destroy the atomic commit mid-loop over its own pipelines
Xaver Hugl <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit d3bf6bc9cb019d7e47a9d39e76b65915f47f8a69 by Xaver Hugl, on behalf of Nick Haghiri.
Committed on 16/07/2026 at 17:03.
Pushed by zamundaaa into branch 'master'.
drm: don't destroy the atomic commit mid-loop over its own pipelines
DrmPipeline::pageFlipped() resets DrmCommitThread::m_committed, which
frees the commit while pageFlipped() is still iterating its m_pipelines.
M +4 -1 src/backends/drm/drm_commit.cpp
https://invent.kde.org/plasma/kwin/-/commit/d3bf6bc9cb019d7e47a9d39e76b65915f47f8a69
diff --git a/src/backends/drm/drm_commit.cpp b/src/backends/drm/drm_commit.cpp
index 5e3fd599ca4..b4fa043f2ec 100644
--- a/src/backends/drm/drm_commit.cpp
+++ b/src/backends/drm/drm_commit.cpp
@@ -192,7 +192,10 @@ void DrmAtomicCommit::pageFlipped(std::chrono::nanoseconds timestamp)
frame->presented(timestamp, m_mode);
}
m_frames.clear();
- for (const auto pipeline : std::as_const(m_pipelines)) {
+ // Iterate a copy: pageFlipped() can reset DrmCommitThread::m_committed, which
+ // destroys this commit - and with it m_pipelines - mid-loop.
+ const auto pipelines = m_pipelines;
+ for (const auto pipeline : pipelines) {
pipeline->pageFlipped(timestamp);
}
}