Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit a123fc9

Browse files
Kevin PetitKevin Petit
Kevin Petit
authored and
Kevin Petit
committed
Tear down old element before disposing the ItemViewAdapter.
1 parent 0c2c676 commit a123fc9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Xamarin.Forms.Platform.Android/CollectionView/ItemsViewRenderer.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,16 @@ protected override void Dispose(bool disposing)
135135
_automationPropertiesProvider?.Dispose();
136136
Tracker?.Dispose();
137137

138-
ItemsViewAdapter?.Dispose();
139-
140138
if (Element != null)
141139
{
142140
TearDownOldElement(Element as ItemsView);
141+
}
143142

143+
// Dispose the adapter after tear down element
144+
ItemsViewAdapter?.Dispose();
145+
146+
if (Element != null)
147+
{
144148
if (Platform.GetRenderer(Element) == this)
145149
{
146150
Element.ClearValue(Platform.RendererProperty);

0 commit comments

Comments
 (0)