From db4b4ec0d3a09b9194b102509b432b5d92b798c6 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 22 Mar 2022 17:41:23 +0100 Subject: [PATCH] Try to fix the crash again --- src/managers/XWaylandManager.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index 05717a58..4f8a15b7 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -49,20 +49,24 @@ void CHyprXWaylandManager::getGeometryForWindow(CWindow* pWindow, wlr_box* pbox) } std::string CHyprXWaylandManager::getTitle(CWindow* pWindow) { - if (pWindow->m_bIsX11) { - if (pWindow->m_uSurface.xwayland) { - return pWindow->m_uSurface.xwayland->title; + try { + if (pWindow->m_bIsX11) { + if (pWindow->m_uSurface.xwayland) { + return std::string(pWindow->m_uSurface.xwayland->title); + } + } else { + return ""; } - } else { - return ""; - } - - if (pWindow->m_uSurface.xdg) { - if (pWindow->m_uSurface.xdg->toplevel) { - return pWindow->m_uSurface.xdg->toplevel->title; + + if (pWindow->m_uSurface.xdg) { + if (pWindow->m_uSurface.xdg->toplevel) { + return std::string(pWindow->m_uSurface.xdg->toplevel->title); + } + } else { + return ""; } - } else { - return ""; + } catch (std::logic_error& e) { + Debug::log(ERR, "Error in getTitle: %s", e.what()); } return "";