Skip to content

Commit

Permalink
screencopy: safer iteration of vector in destroyStream
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Nov 20, 2023
1 parent 716da5e commit 11009ba
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/portals/Screencopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 11009ba

Please sign in to comment.