From 31cc7f3b87d1d9670b66e73e3720da2e2da49acd Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Thu, 24 Jul 2025 00:36:29 +0200 Subject: core: move workspace ptrs to weak (#11194) Fixes some race conditions that come up in tests. We only clean up workspaces when we render a frame. With this, they are always cleared instantly. --- src/Compositor.hpp | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'src/Compositor.hpp') diff --git a/src/Compositor.hpp b/src/Compositor.hpp index 23d1c365..c76a73b2 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -2,6 +2,8 @@ #include +#include + #include "managers/XWaylandManager.hpp" #include "managers/KeybindManager.hpp" #include "managers/SessionLockManager.hpp" @@ -42,7 +44,6 @@ class CCompositor { std::vector m_realMonitors; // for all monitors, even those turned off std::vector m_windows; std::vector m_layers; - std::vector m_workspaces; std::vector m_windowsFadingOut; std::vector m_surfacesFadingOut; @@ -75,6 +76,13 @@ class CCompositor { // ------------------------------------------------- // + auto getWorkspaces() { + return std::views::filter(m_workspaces, [](const auto& e) { return e; }); + } + void registerWorkspace(PHLWORKSPACE w); + + // + PHLMONITOR getMonitorFromID(const MONITORID&); PHLMONITOR getMonitorFromName(const std::string&); PHLMONITOR getMonitorFromDesc(const std::string&); @@ -96,7 +104,6 @@ class CCompositor { PHLWORKSPACE getWorkspaceByID(const WORKSPACEID&); PHLWORKSPACE getWorkspaceByName(const std::string&); PHLWORKSPACE getWorkspaceByString(const std::string&); - void sanityCheckWorkspaces(); PHLWINDOW getUrgentWindow(); bool isWindowActive(PHLWINDOW); void changeWindowZOrder(PHLWINDOW, bool); @@ -156,21 +163,23 @@ class CCompositor { std::string m_explicitConfigPath; private: - void initAllSignals(); - void removeAllSignals(); - void cleanEnvironment(); - void setRandomSplash(); - void initManagers(eManagersInitStage stage); - void prepareFallbackOutput(); - void createLockFile(); - void removeLockFile(); - void setMallocThreshold(); - - bool m_bDrmSyncobjTimelineSupported = false; - - uint64_t m_hyprlandPID = 0; - wl_event_source* m_critSigSource = nullptr; - rlimit m_originalNofile = {}; + void initAllSignals(); + void removeAllSignals(); + void cleanEnvironment(); + void setRandomSplash(); + void initManagers(eManagersInitStage stage); + void prepareFallbackOutput(); + void createLockFile(); + void removeLockFile(); + void setMallocThreshold(); + + bool m_bDrmSyncobjTimelineSupported = false; + + uint64_t m_hyprlandPID = 0; + wl_event_source* m_critSigSource = nullptr; + rlimit m_originalNofile = {}; + + std::vector m_workspaces; }; inline UP g_pCompositor; -- cgit v1.2.3