diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-11-24 19:39:23 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-11-24 19:39:23 +0100 |
commit | a008d8351436c779992ae92062e917fa12f4ed0a (patch) | |
tree | a6711411989ad7763b3e7d17c61bf74f727559ff | |
parent | 3468554eb3ddeac3cbf079ad6ebf3c8a39efc2f2 (diff) |
Fix getting stuck on shutdown with SIGINT
-rw-r--r-- | src/GlobalHotkeysLinux.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/GlobalHotkeysLinux.cpp b/src/GlobalHotkeysLinux.cpp index 975e585..7b1a412 100644 --- a/src/GlobalHotkeysLinux.cpp +++ b/src/GlobalHotkeysLinux.cpp @@ -15,6 +15,12 @@ namespace gsr { } GlobalHotkeysLinux::~GlobalHotkeysLinux() { + if(process_id > 0) { + kill(process_id, SIGKILL); + int status; + waitpid(process_id, &status, 0); + } + for(int i = 0; i < 2; ++i) { if(pipes[i] > 0) close(pipes[i]); @@ -22,12 +28,6 @@ namespace gsr { if(read_file) fclose(read_file); - - if(process_id > 0) { - kill(process_id, SIGKILL); - int status; - waitpid(process_id, &status, 0); - } } bool GlobalHotkeysLinux::start() { @@ -105,4 +105,4 @@ namespace gsr { if(it != bound_actions_by_id.end()) it->second(action); } -}
\ No newline at end of file +} |