Commit ed50ccdc authored by Laurent Aimar's avatar Laurent Aimar

Fixed a potential race condition between "event thread" and manage() (msw).

parent 9e26639a
...@@ -187,6 +187,9 @@ void CommonManage( vout_thread_t *p_vout ) ...@@ -187,6 +187,9 @@ void CommonManage( vout_thread_t *p_vout )
vlc_mutex_unlock( &p_vout->p_sys->lock ); vlc_mutex_unlock( &p_vout->p_sys->lock );
} }
/* */
p_vout->p_sys->i_changes |= EventThreadRetreiveChanges( p_vout->p_sys->p_event );
/* autoscale toggle */ /* autoscale toggle */
if( p_vout->i_changes & VOUT_SCALE_CHANGE ) if( p_vout->i_changes & VOUT_SCALE_CHANGE )
{ {
......
...@@ -240,7 +240,9 @@ static void *EventThread( void *p_this ) ...@@ -240,7 +240,9 @@ static void *EventThread( void *p_this )
break; break;
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
p_event->p_vout->p_sys->i_changes |= VOUT_FULLSCREEN_CHANGE; vlc_mutex_lock( &p_event->lock );
p_event->i_changes |= VOUT_FULLSCREEN_CHANGE;
vlc_mutex_unlock( &p_event->lock );
break; break;
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
...@@ -779,7 +781,11 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message, ...@@ -779,7 +781,11 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
#ifdef UNDER_CE #ifdef UNDER_CE
if( p_vout->p_sys->hparent && if( p_vout->p_sys->hparent &&
hwnd != p_vout->p_sys->hfswnd && p_vout->b_fullscreen ) hwnd != p_vout->p_sys->hfswnd && p_vout->b_fullscreen )
p_vout->p_sys->i_changes |= VOUT_FULLSCREEN_CHANGE; {
vlc_mutex_lock( &p_event->lock );
p_event->i_changes |= VOUT_FULLSCREEN_CHANGE;
vlc_mutex_unlock( &p_event->lock );
}
if( hwnd == p_vout->p_sys->hfswnd ) if( hwnd == p_vout->p_sys->hfswnd )
{ {
...@@ -908,6 +914,15 @@ void EventThreadUpdateTitle( event_thread_t *p_event, const char *psz_fallback ) ...@@ -908,6 +914,15 @@ void EventThreadUpdateTitle( event_thread_t *p_event, const char *psz_fallback )
PostMessage( p_event->p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 ); PostMessage( p_event->p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
} }
unsigned EventThreadRetreiveChanges( event_thread_t *p_event )
{
vlc_mutex_lock( &p_event->lock );
unsigned i_changes = p_event->i_changes;
p_event->i_changes = 0;
vlc_mutex_unlock( &p_event->lock );
return i_changes;
}
event_thread_t *EventThreadCreate( vout_thread_t *p_vout ) event_thread_t *EventThreadCreate( vout_thread_t *p_vout )
{ {
...@@ -946,6 +961,8 @@ void EventThreadDestroy( event_thread_t *p_event ) ...@@ -946,6 +961,8 @@ void EventThreadDestroy( event_thread_t *p_event )
int EventThreadStart( event_thread_t *p_event ) int EventThreadStart( event_thread_t *p_event )
{ {
p_event->i_changes = 0;
p_event->b_ready = false; p_event->b_ready = false;
p_event->b_done = false; p_event->b_done = false;
p_event->b_error = false; p_event->b_error = false;
...@@ -989,8 +1006,5 @@ void EventThreadStop( event_thread_t *p_event ) ...@@ -989,8 +1006,5 @@ void EventThreadStop( event_thread_t *p_event )
vlc_join( p_event->thread, NULL ); vlc_join( p_event->thread, NULL );
p_event->b_ready = false; p_event->b_ready = false;
/* clear the changes formerly signaled */
p_event->p_vout->p_sys->i_changes = 0;
} }
...@@ -45,6 +45,9 @@ typedef struct ...@@ -45,6 +45,9 @@ typedef struct
/* Title */ /* Title */
char *psz_title; char *psz_title;
/* */
unsigned i_changes;
} event_thread_t; } event_thread_t;
#ifdef MODULE_NAME_IS_wingapi #ifdef MODULE_NAME_IS_wingapi
...@@ -267,6 +270,7 @@ void EventThreadStop( event_thread_t * ); ...@@ -267,6 +270,7 @@ void EventThreadStop( event_thread_t * );
void EventThreadMouseAutoHide( event_thread_t * ); void EventThreadMouseAutoHide( event_thread_t * );
void EventThreadUpdateTitle( event_thread_t *, const char *psz_fallback ); void EventThreadUpdateTitle( event_thread_t *, const char *psz_fallback );
unsigned EventThreadRetreiveChanges( event_thread_t * );
/***************************************************************************** /*****************************************************************************
* Prototypes from common.c * Prototypes from common.c
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment