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
1 changed files with 3 additions and 5 deletions

View File

@ -72,9 +72,8 @@ int main(int argc, char** argv, char** envp) {
}
try {
auto configManager = std::make_unique<CConfigManager>(configPath);
configManager->init();
g_pConfigManager = std::move(configManager);
g_pConfigManager = std::make_unique<CConfigManager>(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<CHyprlock>(wlDisplay, immediate);
g_pHyprlock = std::move(hyprlock);
g_pHyprlock = std::make_unique<CHyprlock>(wlDisplay, immediate);
g_pHyprlock->run();
} catch (const std::exception& ex) {
Debug::log(CRIT, "Hyprlock threw: {}", ex.what());