Skip to content

Commit

Permalink
Fix potential race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Aug 28, 2024
1 parent dead811 commit c9cec60
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions TwitchDownloaderWPF/PageQueue.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,12 @@ private static void RemoveTask(TwitchTask task)
return;
}

if (!taskList.Remove(task))
lock (taskLock)
{
MessageBox.Show(Application.Current.MainWindow!, Translations.Strings.TaskCouldNotBeRemoved, Translations.Strings.UnknownErrorOccurred, MessageBoxButton.OK, MessageBoxImage.Error);
if (!taskList.Remove(task))
{
MessageBox.Show(Application.Current.MainWindow!, Translations.Strings.TaskCouldNotBeRemoved, Translations.Strings.UnknownErrorOccurred, MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}

Expand Down

0 comments on commit c9cec60

Please sign in to comment.