-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AdvancedImage.UpdateImage can error with "CancellationTokenSource has been disposed" when redrawn rapidly in virtualizing panels #19
Comments
Hello, @ionite34 Just pushed an |
This seems to still occur but errors on a different line, await Task.Delay(10, cancellationTokenSource.Token); I think the cause is that another call of I reproduced the error in the demo project by modifying this function in private void SetSourceButton_OnClick(object? sender, RoutedEventArgs e)
{
Task.Run(() =>
{
Parallel.ForEach(Enumerable.Range(0, 100), i =>
{
Dispatcher.UIThread.Invoke(() =>
{
CurrentImageExample.Source = $"/Assets/cat{Random.Shared.Next(4, 6)}.jpg";
});
});
});
} I've linked #20 which seems to fix the issue |
Fix ObjectDisposedException in Cancellation token access (#19)
In a virtualizing ItemsRepeater, when scrolling back and forth rapidly and causing redraws, the AdvancedImage.UpdateImage method can error with ObjectDisposedException likely due to the previous call not finishing before the new call, perhaps a lock mechanism is needed?
Relevant lines:
https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia/blob/830e2bfd0ee30e85f81821d8636e4ed59a1084fd/AsyncImageLoader.Avalonia/AdvancedImage.axaml.cs#L189C3-L189C10
The text was updated successfully, but these errors were encountered: