diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-07-05 07:39:04 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-05 07:39:04 +0200 |
commit | c5e1fd97f0629ed0cbc0add6d79d0d215aa89d78 (patch) | |
tree | 43dcc5c8f5b8d002206fc49339b88f26033a5d85 /src | |
parent | b13cbfd5ddb4681778415dc3891d813bf8c2c799 (diff) |
Simplify kill
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/main.cpp b/src/main.cpp index 663695b..687ed8d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -285,17 +285,13 @@ static gboolean on_start_streaming_button_click(GtkButton *button, gpointer user int status; if(waitpid(gpu_screen_recorder_process, &status, 0) == -1) { perror("waitpid failed"); - if(ffmpeg_process != -1) - kill(ffmpeg_process, SIGKILL); /* Ignore... */ - } else { - if(ffmpeg_process != -1) - waitpid(ffmpeg_process, &status, 0); } - } else { - if(ffmpeg_process != -1) - kill(ffmpeg_process, SIGKILL); } + + if(ffmpeg_process != -1) + kill(ffmpeg_process, SIGKILL); + gtk_button_set_label(button, "Start streaming"); streaming = false; gpu_screen_recorder_process = -1; @@ -583,17 +579,11 @@ static gboolean on_destroy_window(GtkWidget *widget, GdkEvent *event, gpointer d int status; if(waitpid(gpu_screen_recorder_process, &status, 0) == -1) { perror("waitpid failed"); - if(ffmpeg_process != -1) - kill(ffmpeg_process, SIGKILL); /* Ignore... */ - } else { - if(ffmpeg_process != -1) - waitpid(ffmpeg_process, &status, 0); } - } else { - if(ffmpeg_process != -1) - kill(ffmpeg_process, SIGKILL); } + if(ffmpeg_process != -1) + kill(ffmpeg_process, SIGKILL); return true; } |