Merge branch '3.2.0' into 3.3.0

This commit is contained in:
Rui Marinho 2018-09-24 12:48:11 +01:00
Родитель 2268657174 16a4e91aac
Коммит e02542411f
3 изменённых файлов: 20 добавлений и 2 удалений

Просмотреть файл

@ -15,6 +15,7 @@ namespace Xamarin.Forms.Platform.Android
{ {
internal class ListViewAdapter : CellAdapter internal class ListViewAdapter : CellAdapter
{ {
bool _disposed;
static readonly object DefaultItemTypeOrDataTemplate = new object(); static readonly object DefaultItemTypeOrDataTemplate = new object();
const int DefaultGroupHeaderTemplateId = 0; const int DefaultGroupHeaderTemplateId = 0;
const int DefaultItemTemplateId = 1; const int DefaultItemTemplateId = 1;
@ -414,6 +415,13 @@ namespace Xamarin.Forms.Platform.Android
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (_disposed)
{
return;
}
_disposed = true;
if (disposing) if (disposing)
{ {
CloseContextActions(); CloseContextActions();

Просмотреть файл

@ -75,6 +75,12 @@ namespace Xamarin.Forms.Platform.Android
_footerView?.Dispose(); _footerView?.Dispose();
_footerView = null; _footerView = null;
// Unhook the adapter from the ListView before disposing of it
if (Control != null)
{
Control.Adapter = null;
}
if (_adapter != null) if (_adapter != null)
{ {
_adapter.Dispose(); _adapter.Dispose();
@ -124,6 +130,12 @@ namespace Xamarin.Forms.Platform.Android
if (_adapter != null) if (_adapter != null)
{ {
// Unhook the adapter from the ListView before disposing of it
if (Control != null)
{
Control.Adapter = null;
}
_adapter.Dispose(); _adapter.Dispose();
_adapter = null; _adapter = null;
} }

Просмотреть файл

@ -273,8 +273,6 @@ namespace Xamarin.Forms.Platform.Android
} }
} }
RemoveAllViews();
if (Element != null) if (Element != null)
{ {
Element.PropertyChanged -= _propertyChangeHandler; Element.PropertyChanged -= _propertyChangeHandler;