summaryrefslogtreecommitdiff
path: root/src/Compositor.cpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2024-08-12 19:19:03 +0200
committerGitHub <noreply@github.com>2024-08-12 18:19:03 +0100
commit3fa6db1e7a7f5596f449ae12d0b45ff364d7f6f1 (patch)
treefda33f86c4706dd151e4cb17908bee60f4434d0a /src/Compositor.cpp
parentd361fcbd85a92f0494c6d8ef0c63aad798df20a7 (diff)
core: fix data race and a unsigned int rollover (#7278)
* keybindmgr: avoid uint rollover on mouse keycode mouse keycode is 0, and the switch case checks for 0 - 8 and rolls over, just return early if keycode is 0. * watchdog: avoid data races in watchdog asan thread sanitizer reported data races in the watchdog from reading and setting the bool variables make them std::atomic bools. also add a atomic bool for the main thread to wait for to avoid data race when reading the config values. * hyprdebug: change non unicode character to name asan created false positives and didnt like this bit, so for the sake of easier debugging rename it to something unicode.
Diffstat (limited to 'src/Compositor.cpp')
-rw-r--r--src/Compositor.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index c3f95961..a2f7c52a 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -552,6 +552,10 @@ void CCompositor::initManagers(eManagersInitStage stage) {
g_pConfigManager->init();
g_pWatchdog = std::make_unique<CWatchdog>(); // requires config
+ // wait for watchdog to initialize to not hit data races in reading config values.
+ while (!g_pWatchdog->m_bWatchdogInitialized) {
+ std::this_thread::yield();
+ }
Debug::log(LOG, "Creating the PointerManager!");
g_pPointerManager = std::make_unique<CPointerManager>();