[DVDnav-discuss] Fix data race condition accessing this->cur_cell_time

Jean-Baptiste Kempf git at videolan.org
Mon Aug 4 19:34:45 CEST 2014


libdvdnav | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Aug  4 19:32:32 2014 +0200| [866b12ecb085417075db9c003c92507d5b261401] | committer: Jean-Baptiste Kempf

Fix data race condition accessing this->cur_cell_time

> http://git.videolan.org/gitweb.cgi/libdvdnav.git/?a=commit;h=866b12ecb085417075db9c003c92507d5b261401
---

 src/searching.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/searching.c b/src/searching.c
index 81155e3..5a63da6 100644
--- a/src/searching.c
+++ b/src/searching.c
@@ -1288,12 +1288,12 @@ dvdnav_status_t dvdnav_jump_to_sector_by_time(dvdnav_t *this,
   /* jump to sector */
   sector_off = jump->sector - cell_data->bgn->sector;
   result = vm_jump_cell_block(this->vm, cell_data->idx, sector_off);
+  pthread_mutex_lock(&this->vm_lock);
   this->cur_cell_time = 0;
-  if (result) {
-    pthread_mutex_lock(&this->vm_lock);
+  if (result) { /* vm_jump_cell_block was sucessful */
     this->vm->hop_channel += HOP_SEEK;
-    pthread_mutex_unlock(&this->vm_lock);
   }
+  pthread_mutex_unlock(&this->vm_lock);
 
 exit:
   return result;



More information about the DVDnav-discuss mailing list