hyprland/ipc: add null checks and ws preinit to toplevel object init

Previously HyprlandToplevel::updateFromObject did not call
findWorkspaceByName with createIfMissing=true, leaving bWorkspace null
for a later insertToplevel call from HyprlandIpc::refreshToplevels.
This commit is contained in:
outfoxxed 2026-03-16 22:38:32 -07:00
parent 365bf16b1e
commit 1bd5b083cb
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
3 changed files with 5 additions and 8 deletions

View file

@ -729,7 +729,7 @@ void HyprlandIpc::refreshToplevels() {
}
auto* workspace = toplevel->bindableWorkspace().value();
workspace->insertToplevel(toplevel);
if (workspace) workspace->insertToplevel(toplevel);
}
});
}

View file

@ -72,20 +72,16 @@ void HyprlandToplevel::updateFromObject(const QVariantMap& object) {
Qt::beginPropertyUpdateGroup();
bool ok = false;
auto address = addressStr.toULongLong(&ok, 16);
if (!ok || !address) {
return;
}
if (ok && address) this->setAddress(address);
this->setAddress(address);
this->bTitle = title;
auto workspaceMap = object.value("workspace").toMap();
auto workspaceName = workspaceMap.value("name").toString();
auto* workspace = this->ipc->findWorkspaceByName(workspaceName, false);
if (!workspace) return;
auto* workspace = this->ipc->findWorkspaceByName(workspaceName, true);
if (workspace) this->setWorkspace(workspace);
this->setWorkspace(workspace);
this->bLastIpcObject = object;
Qt::endPropertyUpdateGroup();
}