[vlc-commits] Android: fix potentially dangling condition variable pointer
Rémi Denis-Courmont
git at videolan.org
Sun May 10 16:40:04 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 10 17:30:27 2015 +0300| [1571438ccb5fcf6410c75cfc8f6e8e82e4b8fc41] | committer: Rémi Denis-Courmont
Android: fix potentially dangling condition variable pointer
This partially reverts commit e9ffcf989a0f342be074eb6835f6f3db69a51a90.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1571438ccb5fcf6410c75cfc8f6e8e82e4b8fc41
---
src/android/thread.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/src/android/thread.c b/src/android/thread.c
index d365d10..d39b29c 100644
--- a/src/android/thread.c
+++ b/src/android/thread.c
@@ -255,13 +255,9 @@ void vlc_cond_wait (vlc_cond_t *condvar, vlc_mutex_t *p_mutex)
if (th != NULL)
{
- if (vlc_mutex_trylock (&th->lock) == 0)
- {
- thread->cond = NULL;
- vlc_mutex_unlock (&th->lock);
- }
- /* Else: This thread was cancelled and is cancellable.
- vlc_testcancel() will take of it right there: */
+ vlc_mutex_lock(&th->lock);
+ th->cond = NULL;
+ vlc_mutex_unlock(&th->lock);
vlc_testcancel();
}
}
@@ -316,13 +312,9 @@ int vlc_cond_timedwait (vlc_cond_t *condvar, vlc_mutex_t *p_mutex,
if (th != NULL)
{
- if (vlc_mutex_trylock (&th->lock) == 0)
- {
- thread->cond = NULL;
- vlc_mutex_unlock (&th->lock);
- }
- /* Else: This thread was cancelled and is cancellable.
- vlc_testcancel() will take of it right there: */
+ vlc_mutex_lock(&th->lock);
+ th->cond = NULL;
+ vlc_mutex_unlock(&th->lock);
vlc_testcancel();
}
return val;
More information about the vlc-commits
mailing list