From c63b4808e8a07d346567ca0a18320a3248df8bbb Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Wed, 23 Jul 2014 14:35:00 +0300 Subject: [PATCH] android/client: Check stream before standby() call Rearrange stop sequence. Fixes following issue: ... Program received signal SIGSEGV, Segmentation fault. 0x00000000004105b8 in stop_p (argc=, argv=) at android/client/if-sco.c:483 483 stream_out->common.standby(&stream_out->common); (gdb) bt out>) at android/client/if-sco.c:483 ... f stop --- android/client/if-sco.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/android/client/if-sco.c b/android/client/if-sco.c index c33b012a9..7a89692ac 100644 --- a/android/client/if-sco.c +++ b/android/client/if-sco.c @@ -473,16 +473,18 @@ static void stop_p(int argc, const char **argv) return; } + if (stream_out) { + pthread_mutex_lock(&outstream_mutex); + stream_out->common.standby(&stream_out->common); + pthread_mutex_unlock(&outstream_mutex); + } + current_state = STATE_STOPPING; pthread_mutex_unlock(&state_mutex); pthread_join(play_thread, NULL); play_thread = 0; - pthread_mutex_lock(&outstream_mutex); - stream_out->common.standby(&stream_out->common); - pthread_mutex_unlock(&outstream_mutex); - haltest_info("Ended %s\n", __func__); } -- 2.47.3