From 89807b61edd4d55ec56085ccd18c7a77148221b4 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Thu, 22 Apr 2021 17:00:36 +0200 Subject: [PATCH] [input] Fix possible segfault-on-exit Could occur if killed during playback (because input_stop() is async, thus referencing cmdbase after it is destroyed) --- src/input.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/input.c b/src/input.c index da339467..d6425f1c 100644 --- a/src/input.c +++ b/src/input.c @@ -842,6 +842,12 @@ input_stop(void) commands_exec_async(cmdbase, stop_cmd, NULL); } +static void +input_stop_sync(void) +{ + commands_exec_sync(cmdbase, stop_cmd, NULL, NULL); +} + void input_flush(short *flags) { @@ -929,8 +935,7 @@ input_deinit(void) int i; int ret; -// TODO ok to do from here? - input_stop(); + input_stop_sync(); for (i = 0; inputs[i]; i++) {