Skip to content

Commit

Permalink
window: avoid uaf on updateWindow decos
Browse files Browse the repository at this point in the history
TODO, make these pointers SP to avoid this in the future.

fixes #5909
  • Loading branch information
vaxerski committed May 7, 2024
1 parent 6ccc221 commit 598bbd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/desktop/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ void CWindow::updateWindowDecos() {
}

for (auto& wd : decos) {
if (std::find_if(m_dWindowDecorations.begin(), m_dWindowDecorations.end(), [wd](const auto& other) { return other.get() == wd; }) == m_dWindowDecorations.end())
continue;
wd->updateWindow(m_pSelf.lock());
}
}
Expand Down
1 change: 1 addition & 0 deletions src/desktop/Window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ class CWindow {
PHLWINDOWREF m_pLastCycledWindow;

// Window decorations
// TODO: make this a SP.
std::deque<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
std::vector<IHyprWindowDecoration*> m_vDecosToRemove;

Expand Down

0 comments on commit 598bbd1

Please sign in to comment.