[vlc-devel] commit: video_output: Make sure we check p_vout-> b_die inside the object lock. (Pierre d'Herbemont )
git version control
git at videolan.org
Wed May 28 03:10:11 CEST 2008
vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Wed May 28 02:46:01 2008 +0200| [aeaf0da4ea02c39b49bc49493a8a6c2de3dec411]
video_output: Make sure we check p_vout->b_die inside the object lock.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aeaf0da4ea02c39b49bc49493a8a6c2de3dec411
---
src/video_output/video_output.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 1549496..45a32dd 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -762,6 +762,8 @@ static void RunThread( vout_thread_t *p_vout)
if( p_vout->b_error )
return;
+ vlc_object_lock( p_vout );
+
if( p_vout->b_title_show )
DisplayTitleOnOSD( p_vout );
@@ -769,7 +771,7 @@ static void RunThread( vout_thread_t *p_vout)
* Main loop - it is not executed if an error occurred during
* initialization
*/
- while( (!p_vout->b_die) && (!p_vout->b_error) )
+ while( (vlc_object_alive( p_vout )) && (!p_vout->b_error) )
{
/* Initialize loop variables */
p_picture = NULL;
@@ -1091,6 +1093,8 @@ static void RunThread( vout_thread_t *p_vout)
/* Give back change lock */
vlc_mutex_unlock( &p_vout->change_lock );
+ vlc_object_unlock( p_vout );
+
/* Sleep a while or until a given date */
if( display_date != 0 )
{
@@ -1108,6 +1112,9 @@ static void RunThread( vout_thread_t *p_vout)
/* On awakening, take back lock and send immediately picture
* to display. */
+ vlc_object_lock( p_vout );
+ /* Note: vlc_object_alive() could be false here, and we
+ * could be dead */
vlc_mutex_lock( &p_vout->change_lock );
/*
@@ -1201,6 +1208,7 @@ static void RunThread( vout_thread_t *p_vout)
}
}
+
if( p_input )
{
vlc_object_release( p_input );
@@ -1216,6 +1224,7 @@ static void RunThread( vout_thread_t *p_vout)
/* End of thread */
EndThread( p_vout );
+ vlc_object_unlock( p_vout );
}
/*****************************************************************************
More information about the vlc-devel
mailing list