From bbed23df60c4bfc067b4f7c03574cfe11cc8bb60 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 20 Apr 2012 22:05:22 +0200 Subject: Don’t unlock mutex that is not locked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Strict pthread implementations (like OpenBSD’s rthreads with PTHREAD_MUTEX_TYPE_STRICT_NP set) don’t allow unlocking a mutex that is not locked, resulting in abort() being called. Always aquiring the lock before unlocking it while skipping to the next song fixes this. Thanks to David Coppa. --- src/ui_act.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui_act.c b/src/ui_act.c index 2cc559f..76b9411 100644 --- a/src/ui_act.c +++ b/src/ui_act.c @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2011 +Copyright (c) 2008-2012 Lars-Dominik Braun Permission is hereby granted, free of charge, to any person obtaining a copy @@ -50,6 +50,8 @@ static inline void BarUiDoSkipSong (struct audioPlayer *player) { assert (player != NULL); player->doQuit = 1; + /* unlocking an unlocked mutex is forbidden by some implementations */ + pthread_mutex_trylock (&player->pauseMutex); pthread_mutex_unlock (&player->pauseMutex); } -- cgit v1.2.3