From c5e1fd97f0629ed0cbc0add6d79d0d215aa89d78 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 5 Jul 2020 07:39:04 +0200 Subject: Simplify kill --- src/main.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3