Fixed exception on task dispose (fix #357)
This commit is contained in:
1 parent
330f755c44
commit
e99f1adfae
1 file changed
-7
@@ -263,7 +263,6 @@ namespace Vocaluxe.Base
|
|||||||
if (_PreviewStartHelperTask != null && (_PreviewPlayer.Length > 0 || _PreviewStartWaitCounter++ >= _PreviewStartWaitMaxTries))
|
if (_PreviewStartHelperTask != null && (_PreviewPlayer.Length > 0 || _PreviewStartWaitCounter++ >= _PreviewStartWaitMaxTries))
|
||||||
{
|
{
|
||||||
_PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext());
|
_PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext());
|
||||||
_PreviewStartHelperTask.Dispose();
|
|
||||||
_PreviewStartHelperTask = null;
|
_PreviewStartHelperTask = null;
|
||||||
_PreviewStartWaitCounter = 0;
|
_PreviewStartWaitCounter = 0;
|
||||||
}
|
}
|
||||||
@@ -327,11 +326,6 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
lock (_PreviewStartHelperTaskLock)
|
lock (_PreviewStartHelperTaskLock)
|
||||||
{
|
{
|
||||||
// Check if the old _PreviewStartHelperTask needs to disposed
|
|
||||||
if (_PreviewStartHelperTask != null)
|
|
||||||
{
|
|
||||||
_PreviewStartHelperTask.Dispose();
|
|
||||||
}
|
|
||||||
_PreviewStartHelperTask = new Task(() =>
|
_PreviewStartHelperTask = new Task(() =>
|
||||||
{
|
{
|
||||||
float length = _PreviewPlayer.Length;
|
float length = _PreviewPlayer.Length;
|
||||||
@@ -360,7 +354,6 @@ namespace Vocaluxe.Base
|
|||||||
// Recheck the condition as it cloud have change before we got the lock
|
// Recheck the condition as it cloud have change before we got the lock
|
||||||
if (_PreviewStartHelperTask != null)
|
if (_PreviewStartHelperTask != null)
|
||||||
{
|
{
|
||||||
_PreviewStartHelperTask.Dispose();
|
|
||||||
_PreviewStartHelperTask = null;
|
_PreviewStartHelperTask = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user