]> git.sesse.net Git - mlt/commit
sdl/consumer_sdl_still.c: use mutex when changing sdl_screen
authorMikko Rapeli <mikko.rapeli@iki.fi>
Wed, 1 Aug 2012 15:28:49 +0000 (17:28 +0200)
committerMikko Rapeli <mikko.rapeli@iki.fi>
Mon, 6 Aug 2012 16:37:29 +0000 (18:37 +0200)
commit8c56954db6e2bfcb4e515c2515343cc32cd5ca1e
treeb57d7252b4c48e0e436cc3819afffa0e8afd658a
parent9f5a3b4a9a7a572751e9fcfcc021ba1b5970e902
sdl/consumer_sdl_still.c: use mutex when changing sdl_screen

Fixes Coverity CID 709357: Data race condition (MISSING_LOCK)
Accessing variable "this->sdl_screen" (consumer_sdl_s.sdl_screen) requires the mlt_sdl_mutex lock.
230                this->sdl_screen = NULL;
...
Locking "mlt_sdl_mutex".
445                pthread_mutex_lock( &mlt_sdl_mutex );
consumer_sdl_s.sdl_screen is being accessed with lock "mlt_sdl_mutex" held.
446                this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );
447                if ( consumer_get_dimensions( &this->window_width, &this->window_height ) )
448                        this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );
449
450                uint32_t color = mlt_properties_get_int( this->properties, "window_background" );
451                if ( this->sdl_screen )
452                {
453                        SDL_FillRect( this->sdl_screen, NULL, color >> 8 );
454                        changed = 1;
455                }
456                pthread_mutex_unlock( &mlt_sdl_mutex );
src/modules/sdl/consumer_sdl_still.c