screencopy: safer iteration of vector in destroyStream

This commit is contained in:
Vaxry 2023-11-20 18:52:06 +00:00
parent 716da5e0f3
commit 11009ba077
1 changed files with 6 additions and 0 deletions

View File

@ -1009,7 +1009,13 @@ void CPipewireConnection::destroyStream(CScreencopyPortal::SSession* pSession) {
return;
if (!PSTREAM->buffers.empty()) {
std::vector<SBuffer*> bufs;
for (auto& b : PSTREAM->buffers) {
bufs.push_back(b.get());
}
for (auto& b : bufs) {
pwStreamRemoveBuffer(PSTREAM, b->pwBuffer);
}
}