Details
-
Bug
-
Resolution: Fixed
-
Major
-
2.4.1
-
None
Description
When an ItemsControl sets a VirtualizingPanel's ItemProvider and the panel is still in the preparing state, the old ItemProvider is disposed without locking, e.g. here https://github.com/MediaPortal/MediaPortal-2/blob/1145c74af454a8e003f6a5f43f69126c435b94e7/MediaPortal/Source/UI/SkinEngine/Controls/Panels/VirtualizingStackPanel.cs#L129-L138
This can lead to the VirtualizingPanel attempting to retrieve items from the old disposed provider when it does it's initial arrange. The old provider then returns null items and due to a bug this causes the panel to get stuck in an infinite loop due to it continually requesting the same null item e.g. here - https://github.com/MediaPortal/MediaPortal-2/blob/1145c74af454a8e003f6a5f43f69126c435b94e7/MediaPortal/Source/UI/SkinEngine/Controls/Panels/VirtualizingStackPanel.cs#L507-L508
There are two parts that need resolving:
Ideally the panel should not be using the disposed provider, so the panel should always lock when updating the provider regardless of whether it's in the preparing state. Secondly, the loop should exit cleanly if an item provider returns a null or not visible item.
This can lead to the VirtualizingPanel attempting to retrieve items from the old disposed provider when it does it's initial arrange. The old provider then returns null items and due to a bug this causes the panel to get stuck in an infinite loop due to it continually requesting the same null item e.g. here - https://github.com/MediaPortal/MediaPortal-2/blob/1145c74af454a8e003f6a5f43f69126c435b94e7/MediaPortal/Source/UI/SkinEngine/Controls/Panels/VirtualizingStackPanel.cs#L507-L508
There are two parts that need resolving:
Ideally the panel should not be using the disposed provider, so the panel should always lock when updating the provider regardless of whether it's in the preparing state. Secondly, the loop should exit cleanly if an item provider returns a null or not visible item.