protocols/xdg-shell: fix crash on null parent in pin (#12694)

This commit is contained in:
UjinT34 2025-12-21 16:21:51 +03:00 committed by GitHub
parent c87a1a7629
commit 712bcfbce5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -257,11 +257,12 @@ CXDGToplevelResource::CXDGToplevelResource(SP<CXdgToplevel> resource_, SP<CXDGSu
m_parent = newp;
if (m_parent)
if (m_parent) {
m_parent->m_children.emplace_back(m_self);
if (m_parent->m_window->m_pinned)
m_self->m_window->m_pinned = true;
if (m_parent->m_window && m_parent->m_window->m_pinned)
m_self->m_window->m_pinned = true;
}
LOGM(Log::DEBUG, "Toplevel {:x} sets parent to {:x}{}", (uintptr_t)this, (uintptr_t)newp.get(), (oldParent ? std::format(" (was {:x})", (uintptr_t)oldParent.get()) : ""));
});