You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
I think the cause is that another call of UpdateImage, despite the interlocked exchange, can get the var cancellationTokenSource = new CancellationTokenSource(); and disposes it before the cancellationTokenSource.Token access which errors.
I reproduced the error in the demo project by modifying this function in AdvancedImagePage to do a lot of Source changes
privatevoidSetSourceButton_OnClick(object?sender,RoutedEventArgse){Task.Run(()=>{Parallel.ForEach(Enumerable.Range(0,100), i =>{Dispatcher.UIThread.Invoke(()=>{CurrentImageExample.Source=$"/Assets/cat{Random.Shared.Next(4,6)}.jpg";});});});}
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: