]> git.sesse.net Git - mlt/commit
sdl/consumer_sdl_preview.c: use mutex when changing refresh_count
authorMikko Rapeli <mikko.rapeli@iki.fi>
Wed, 1 Aug 2012 15:21:51 +0000 (17:21 +0200)
committerMikko Rapeli <mikko.rapeli@iki.fi>
Mon, 6 Aug 2012 16:37:28 +0000 (18:37 +0200)
commit9f5a3b4a9a7a572751e9fcfcc021ba1b5970e902
tree0d247ed59979e3134a43576ad43e0bdb8ae077d8
parentdcb37f6602a1ebf65e9860bf1a344063f139032d
sdl/consumer_sdl_preview.c: use mutex when changing refresh_count

Fixes Coverity CID 709360: Data race condition (MISSING_LOCK)

Locking "this->refresh_mutex".
133                pthread_mutex_lock( &this->refresh_mutex );
consumer_sdl_s.refresh_count is being accessed with lock "this->refresh_mutex" held.
134                this->refresh_count = this->refresh_count <= 0 ? 1 : this->refresh_count + 1;
135                pthread_cond_broadcast( &this->refresh_cond );
136                pthread_mutex_unlock( &this->refresh_mutex );
...
Accessing variable "this->refresh_count" (consumer_sdl_s.refresh_count) requires the consumer_sdl_s.refresh_mutex lock.
295        this->refresh_count = 0;
...
Locking "this->refresh_mutex".
445                                pthread_mutex_lock( &this->refresh_mutex );
446                                if ( this->running && speed == 0 && this->refresh_count <= 0 )
447                                {
448                                        mlt_events_fire( properties, "consumer-sdl-paused", NULL );
449                                        pthread_cond_wait( &this->refresh_cond, &this->refresh_mutex );
450                                }
consumer_sdl_s.refresh_count is being accessed with lock "this->refresh_mutex" held.
451                                this->refresh_count --;
452                                pthread_mutex_unlock( &this->refresh_mutex );
src/modules/sdl/consumer_sdl_preview.c