summaryrefslogtreecommitdiff
path: root/src/layout/MasterLayout.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-12-12 14:18:43 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-12-12 14:18:43 +0000
commit06e6c6021e4765f3603bb5522b9d9f1ec0f66390 (patch)
treec37863ab63d32acd87b63d3b0cb756216394022f /src/layout/MasterLayout.cpp
parente8b99ae13a0525f9fbd6899fe39fe723879f86b9 (diff)
fix memory read-after-free in master layout
Diffstat (limited to 'src/layout/MasterLayout.cpp')
-rw-r--r--src/layout/MasterLayout.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp
index 19b675f4..19f22fb5 100644
--- a/src/layout/MasterLayout.cpp
+++ b/src/layout/MasterLayout.cpp
@@ -152,11 +152,13 @@ void CHyprMasterLayout::onWindowRemovedTiling(CWindow* pWindow) {
}
}
+ const auto WORKSPACEID = PNODE->workspaceID;
+
m_lMasterNodesData.remove(*PNODE);
- if (getMastersOnWorkspace(PNODE->workspaceID) == getNodesOnWorkspace(PNODE->workspaceID) && MASTERSLEFT > 1) {
+ if (getMastersOnWorkspace(WORKSPACEID) == getNodesOnWorkspace(WORKSPACEID) && MASTERSLEFT > 1) {
for (auto it = m_lMasterNodesData.rbegin(); it != m_lMasterNodesData.rend(); it++) {
- if (it->workspaceID == PNODE->workspaceID) {
+ if (it->workspaceID == WORKSPACEID) {
it->isMaster = false;
break;
}