diff options
| author | Zach DeCook <zachdecook@librem.one> | 2025-01-20 13:40:51 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-20 18:40:51 +0000 |
| commit | a661203bb6d4714b211572759e2f74b1da194972 (patch) | |
| tree | 7b2b18e5f84197e18ed54c48dff762e6aa7b2ed7 /src/config/ConfigManager.cpp | |
| parent | 9e8d9791c7f9b7d1183110da370772a8b2c1b6f4 (diff) | |
xwayland: fix crash when trying to initialize without Xwayland installed (#9077)
Diffstat (limited to 'src/config/ConfigManager.cpp')
| -rw-r--r-- | src/config/ConfigManager.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 0347ced4..40f8d9ef 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -950,26 +950,16 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) { } #ifndef NO_XWAYLAND - const auto PENABLEXWAYLAND = std::any_cast<Hyprlang::INT>(m_pConfig->getConfigValue("xwayland:enabled")); + const auto PENABLEXWAYLAND = std::any_cast<Hyprlang::INT>(m_pConfig->getConfigValue("xwayland:enabled")); + g_pCompositor->m_bWantsXwayland = PENABLEXWAYLAND; // enable/disable xwayland usage if (!isFirstLaunch) { - bool prevEnabledXwayland = g_pCompositor->m_bEnableXwayland; - if (PENABLEXWAYLAND != prevEnabledXwayland) { - g_pCompositor->m_bEnableXwayland = PENABLEXWAYLAND; - if (PENABLEXWAYLAND) { - Debug::log(LOG, "xwayland has been enabled"); - } else { - Debug::log(LOG, "xwayland has been disabled, cleaning up..."); - for (auto& w : g_pCompositor->m_vWindows) { - if (w->m_pXDGSurface || !w->m_bIsX11) - continue; - g_pCompositor->closeWindow(w); - } - } - g_pXWayland = std::make_unique<CXWayland>(g_pCompositor->m_bEnableXwayland); + bool prevEnabledXwayland = g_pXWayland->enabled(); + if (g_pCompositor->m_bWantsXwayland != prevEnabledXwayland) { + g_pXWayland = std::make_unique<CXWayland>(g_pCompositor->m_bWantsXwayland); } } else - g_pCompositor->m_bEnableXwayland = PENABLEXWAYLAND; + g_pCompositor->m_bWantsXwayland = PENABLEXWAYLAND; #endif if (!isFirstLaunch && !g_pCompositor->m_bUnsafeState) |
