protocols/workspace: fix crash in initial group sending

fixes #12419
This commit is contained in:
Vaxry 2025-11-21 14:45:59 +00:00
parent d66c9222b0
commit 79a2781923
No known key found for this signature in database
GPG key ID: 665806380871D640
2 changed files with 8 additions and 3 deletions

View file

@ -31,9 +31,6 @@ CExtWorkspaceGroupResource::CExtWorkspaceGroupResource(WP<CExtWorkspaceManagerRe
if (output->client() == m_resource->client()) if (output->client() == m_resource->client())
m_resource->sendOutputEnter(output->getResource()->resource()); m_resource->sendOutputEnter(output->getResource()->resource());
}); });
m_manager->sendGroupToWorkspaces(m_self);
m_manager->scheduleDone();
} }
bool CExtWorkspaceGroupResource::good() const { bool CExtWorkspaceGroupResource::good() const {
@ -46,6 +43,11 @@ WP<CExtWorkspaceGroupResource> CExtWorkspaceGroupResource::fromResource(wl_resou
return data ? data->m_self : WP<CExtWorkspaceGroupResource>(); return data ? data->m_self : WP<CExtWorkspaceGroupResource>();
} }
void CExtWorkspaceGroupResource::sendToWorkspaces() {
m_manager->sendGroupToWorkspaces(m_self);
m_manager->scheduleDone();
}
void CExtWorkspaceGroupResource::workspaceEnter(const WP<CExtWorkspaceHandleV1>& handle) { void CExtWorkspaceGroupResource::workspaceEnter(const WP<CExtWorkspaceHandleV1>& handle) {
m_resource->sendWorkspaceEnter(handle.get()); m_resource->sendWorkspaceEnter(handle.get());
} }
@ -265,6 +267,7 @@ void CExtWorkspaceManagerResource::onMonitorCreated(const PHLMONITOR& monitor) {
auto& group = PROTO::extWorkspace->m_groups.emplace_back( auto& group = PROTO::extWorkspace->m_groups.emplace_back(
makeUnique<CExtWorkspaceGroupResource>(m_self, makeUnique<CExtWorkspaceGroupHandleV1>(m_resource->client(), m_resource->version(), 0), monitor)); makeUnique<CExtWorkspaceGroupResource>(m_self, makeUnique<CExtWorkspaceGroupHandleV1>(m_resource->client(), m_resource->version(), 0), monitor));
group->m_self = group; group->m_self = group;
group->sendToWorkspaces();
if UNLIKELY (!group->good()) { if UNLIKELY (!group->good()) {
LOGM(ERR, "Couldn't create a workspace group object"); LOGM(ERR, "Couldn't create a workspace group object");

View file

@ -21,6 +21,8 @@ class CExtWorkspaceGroupResource {
void workspaceEnter(const WP<CExtWorkspaceHandleV1>&); void workspaceEnter(const WP<CExtWorkspaceHandleV1>&);
void workspaceLeave(const WP<CExtWorkspaceHandleV1>&); void workspaceLeave(const WP<CExtWorkspaceHandleV1>&);
void sendToWorkspaces();
PHLMONITORREF m_monitor; PHLMONITORREF m_monitor;
private: private: