From 0f66aeac03ae4dda5223768c31ce720b9272e1db Mon Sep 17 00:00:00 2001 From: Maximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com> Date: Fri, 28 Jun 2024 18:57:38 +0200 Subject: [PATCH] core: fix sourcing config files (#387) * core: fix sourcing config files The `handleSource` handle relies on `g_pConfigManager`, which therefore needs to be moved before `init`. * core: remove unnecessary unique pointer moves --- src/main.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 547b849..6273a3b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -72,9 +72,8 @@ int main(int argc, char** argv, char** envp) { } try { - auto configManager = std::make_unique(configPath); - configManager->init(); - g_pConfigManager = std::move(configManager); + g_pConfigManager = std::make_unique(configPath); + g_pConfigManager->init(); } catch (const std::exception& ex) { Debug::log(CRIT, "ConfigManager threw: {}", ex.what()); if (std::string(ex.what()).contains("File does not exist")) @@ -84,8 +83,7 @@ int main(int argc, char** argv, char** envp) { } try { - auto hyprlock = std::make_unique(wlDisplay, immediate); - g_pHyprlock = std::move(hyprlock); + g_pHyprlock = std::make_unique(wlDisplay, immediate); g_pHyprlock->run(); } catch (const std::exception& ex) { Debug::log(CRIT, "Hyprlock threw: {}", ex.what());