diff options
author | Reinhard Nißl <rnissl@gmx.de> | 2010-07-15 21:02:29 +0200 |
---|---|---|
committer | Reinhard Nißl <rnissl@gmx.de> | 2010-07-15 21:02:29 +0200 |
commit | 381cde936a88888674b1be36e3c9ffa7cf507877 (patch) | |
tree | 18793eefc830873ce2bb7164a2b1a99139284bbc /src | |
parent | 8b33d4f0954f119a2e067b47deac26cf84f9be70 (diff) | |
download | xine-lib-381cde936a88888674b1be36e3c9ffa7cf507877.tar.gz xine-lib-381cde936a88888674b1be36e3c9ffa7cf507877.tar.bz2 |
Fix locking order of drawable and display to avoid deadlock.
It is known to everyone that locking serveral resources requires a consistent
order on all places where these resources are required. Otherwise a deadlock
will happen.
Diffstat (limited to 'src')
-rw-r--r-- | src/video_out/video_out_vdpau.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/video_out/video_out_vdpau.c b/src/video_out/video_out_vdpau.c index 2df846db3..e512a4127 100644 --- a/src/video_out/video_out_vdpau.c +++ b/src/video_out/video_out_vdpau.c @@ -1959,54 +1959,54 @@ static int vdpau_gui_data_exchange (vo_driver_t *this_gen, int data_type, void * case XINE_GUI_SEND_EXPOSE_EVENT: { if ( this->init_queue ) { + pthread_mutex_lock(&this->drawable_lock); /* wait for other thread which is currently displaying */ #ifdef LOCKDISPLAY XLockDisplay( this->display ); #endif - pthread_mutex_lock(&this->drawable_lock); /* wait for other thread which is currently displaying */ int previous = this->current_output_surface - 1; if ( previous < 0 ) previous = NOUTPUTSURFACE - 1; vdp_queue_display( vdp_queue, this->output_surface[previous], 0, 0, 0 ); - pthread_mutex_unlock(&this->drawable_lock); #ifdef LOCKDISPLAY XUnlockDisplay( this->display ); #endif + pthread_mutex_unlock(&this->drawable_lock); } break; } case XINE_GUI_SEND_DRAWABLE_CHANGED: { VdpStatus st; + pthread_mutex_lock(&this->drawable_lock); /* wait for other thread which is currently displaying */ #ifdef LOCKDISPLAY XLockDisplay( this->display ); #endif - pthread_mutex_lock(&this->drawable_lock); /* wait for other thread which is currently displaying */ this->drawable = (Drawable) data; vdp_queue_destroy( vdp_queue ); vdp_queue_target_destroy( vdp_queue_target ); st = vdp_queue_target_create_x11( vdp_device, this->drawable, &vdp_queue_target ); if ( st != VDP_STATUS_OK ) { fprintf(stderr, "vo_vdpau: FATAL !! Can't recreate presentation queue target after drawable change !!\n" ); - pthread_mutex_unlock(&this->drawable_lock); #ifdef LOCKDISPLAY XUnlockDisplay( this->display ); #endif + pthread_mutex_unlock(&this->drawable_lock); break; } st = vdp_queue_create( vdp_device, vdp_queue_target, &vdp_queue ); if ( st != VDP_STATUS_OK ) { fprintf(stderr, "vo_vdpau: FATAL !! Can't recreate presentation queue after drawable change !!\n" ); - pthread_mutex_unlock(&this->drawable_lock); #ifdef LOCKDISPLAY XUnlockDisplay( this->display ); #endif + pthread_mutex_unlock(&this->drawable_lock); break; } vdp_queue_set_background_color( vdp_queue, &this->back_color ); - pthread_mutex_unlock(&this->drawable_lock); #ifdef LOCKDISPLAY XUnlockDisplay( this->display ); #endif + pthread_mutex_unlock(&this->drawable_lock); this->sc.force_redraw = 1; break; } |