fix threading bug in movie scanner
This commit is contained in:
parent
3ec314d20b
commit
a283b2d1b9
|
@ -87,26 +87,27 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var index = IsDuplicateOf(filename);
|
//System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start();
|
||||||
if (!index.HasValue)
|
var movie = PreLoadMovieFile(file, force);
|
||||||
|
if (movie == null)
|
||||||
{
|
{
|
||||||
//System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start();
|
return null;
|
||||||
var movie = PreLoadMovieFile(file, force);
|
|
||||||
if (movie == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//watch.Stop(); Console.WriteLine("[{0}] {1}",watch.ElapsedMilliseconds,Path.GetFileName(filename));
|
|
||||||
|
|
||||||
lock (_movieList)
|
|
||||||
{
|
|
||||||
_movieList.Add(movie);
|
|
||||||
index = _movieList.Count - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_sortReverse = false;
|
|
||||||
_sortedCol = string.Empty;
|
|
||||||
}
|
}
|
||||||
|
//watch.Stop(); Console.WriteLine("[{0}] {1}",watch.ElapsedMilliseconds,Path.GetFileName(filename));
|
||||||
|
|
||||||
|
int? index;
|
||||||
|
lock (_movieList)
|
||||||
|
{
|
||||||
|
//need to check IsDuplicateOf within the lock
|
||||||
|
index = IsDuplicateOf(filename);
|
||||||
|
if (index.HasValue) return index;
|
||||||
|
|
||||||
|
_movieList.Add(movie);
|
||||||
|
index = _movieList.Count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_sortReverse = false;
|
||||||
|
_sortedCol = string.Empty;
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue