Merge pull request #3695 from cfillion/fix-hyprland-crashes

Fix a crash after handling SIGINT and a data race when initializing the Hyprland workspace modules
This commit is contained in:
Alexis Rouillard
2024-10-21 14:58:34 +02:00
committed by GitHub
2 changed files with 7 additions and 0 deletions

View File

@ -107,6 +107,10 @@ int main(int argc, char* argv[]) {
ret = client->main(argc, argv); ret = client->main(argc, argv);
} while (reload); } while (reload);
std::signal(SIGUSR1, SIG_IGN);
std::signal(SIGUSR2, SIG_IGN);
std::signal(SIGINT, SIG_IGN);
delete client; delete client;
return ret; return ret;
} catch (const std::exception& e) { } catch (const std::exception& e) {

View File

@ -18,6 +18,9 @@ namespace waybar::modules::hyprland {
std::filesystem::path IPC::socketFolder_; std::filesystem::path IPC::socketFolder_;
std::filesystem::path IPC::getSocketFolder(const char* instanceSig) { std::filesystem::path IPC::getSocketFolder(const char* instanceSig) {
static std::mutex folderMutex;
std::unique_lock lock(folderMutex);
// socket path, specified by EventManager of Hyprland // socket path, specified by EventManager of Hyprland
if (!socketFolder_.empty()) { if (!socketFolder_.empty()) {
return socketFolder_; return socketFolder_;