fix memory read-after-free in master layout

This commit is contained in:
vaxerski 2022-12-12 14:18:43 +00:00
parent e8b99ae13a
commit 06e6c6021e
1 changed files with 4 additions and 2 deletions

View File

@ -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;
}