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
This commit is contained in:
Maximilian Seidler 2024-06-28 18:57:38 +02:00 committed by GitHub
parent 318c00d6d0
commit 0f66aeac03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -72,9 +72,8 @@ int main(int argc, char** argv, char** envp) {
} }
try { try {
auto configManager = std::make_unique<CConfigManager>(configPath); g_pConfigManager = std::make_unique<CConfigManager>(configPath);
configManager->init(); g_pConfigManager->init();
g_pConfigManager = std::move(configManager);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
Debug::log(CRIT, "ConfigManager threw: {}", ex.what()); Debug::log(CRIT, "ConfigManager threw: {}", ex.what());
if (std::string(ex.what()).contains("File does not exist")) if (std::string(ex.what()).contains("File does not exist"))
@ -84,8 +83,7 @@ int main(int argc, char** argv, char** envp) {
} }
try { try {
auto hyprlock = std::make_unique<CHyprlock>(wlDisplay, immediate); g_pHyprlock = std::make_unique<CHyprlock>(wlDisplay, immediate);
g_pHyprlock = std::move(hyprlock);
g_pHyprlock->run(); g_pHyprlock->run();
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
Debug::log(CRIT, "Hyprlock threw: {}", ex.what()); Debug::log(CRIT, "Hyprlock threw: {}", ex.what());