From f886eb94a29096d510defa6ecfaa16d5591ef477 Mon Sep 17 00:00:00 2001 From: j4kuuu Date: Mon, 9 Nov 2026 23:38:55 +0100 Subject: [PATCH] window: don't wrap a null swapchain buffer resizeSwapchain wrapped swapchain->next() in a CWaylandBuffer without checking it. next() is null when the swapchain can't allocate (a software renderer with no dmabuf), and the ctor dereferences it, so the app segfaults on first configure. Leave the slot empty instead; render() and onPreRender already bail when a buffer is missing. --- src/window/IWaylandWindow.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/window/IWaylandWindow.cpp b/src/window/IWaylandWindow.cpp index 33ea5e3..3cc5d54 100644 --- a/src/window/IWaylandWindow.cpp +++ b/src/window/IWaylandWindow.cpp @@ -83,7 +83,16 @@ void IWaylandWindow::resizeSwapchain(const Vector2D& pixelSize) { }); for (size_t i = 0; i < m_waylandState.wlBuffers.size(); ++i) { - m_waylandState.wlBuffers[i] = makeShared(m_waylandState.swapchain->next(nullptr)); + // next() is null when the swapchain can't allocate (e.g. a software renderer with no dmabuf). + // wrapping that in a CWaylandBuffer dereferences null; leave the slot empty instead, onPreRender + // and render both already bail when a buffer is missing. + auto buf = m_waylandState.swapchain->next(nullptr); + if (!buf) { + g_logger->log(HT_LOG_ERROR, "resizeSwapchain: swapchain could not allocate a buffer"); + m_waylandState.wlBuffers[i].reset(); + continue; + } + m_waylandState.wlBuffers[i] = makeShared(buf); } }