Skip to content

Commit 712bcfb

Browse files
authored
protocols/xdg-shell: fix crash on null parent in pin (#12694)
1 parent c87a1a7 commit 712bcfb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/protocols/XDGShell.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,12 @@ CXDGToplevelResource::CXDGToplevelResource(SP<CXdgToplevel> resource_, SP<CXDGSu
257257

258258
m_parent = newp;
259259

260-
if (m_parent)
260+
if (m_parent) {
261261
m_parent->m_children.emplace_back(m_self);
262262

263-
if (m_parent->m_window->m_pinned)
264-
m_self->m_window->m_pinned = true;
263+
if (m_parent->m_window && m_parent->m_window->m_pinned)
264+
m_self->m_window->m_pinned = true;
265+
}
265266

266267
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()) : ""));
267268
});

0 commit comments

Comments
 (0)