aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-05-07 16:50:30 +0100
committerVaxry <[email protected]>2024-05-07 17:37:06 +0100
commit598bbd186b1e6e70a01ba7f98c89404531008f15 (patch)
tree5c92ad9c30919763b87f1044ff5ca731ee91ace0
parent6ccc22194ca2d16bd7dc4b7263f897a547c50e6b (diff)
downloadHyprland-598bbd186b1e6e70a01ba7f98c89404531008f15.tar.gz
Hyprland-598bbd186b1e6e70a01ba7f98c89404531008f15.zip
window: avoid uaf on updateWindow decos
TODO, make these pointers SP to avoid this in the future. fixes #5909
-rw-r--r--src/desktop/Window.cpp2
-rw-r--r--src/desktop/Window.hpp1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index b4af12f1..00066b27 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -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());
}
}
diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp
index dd361c30..40e5db49 100644
--- a/src/desktop/Window.hpp
+++ b/src/desktop/Window.hpp
@@ -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;