[GTK] Fixed problem disposing childs navigating back (#3116) Fixes #2987

* Fixed problem disposing childs navigating back

* Fixed text format
This commit is contained in:
Javier Suárez Ruiz 2018-08-08 11:04:22 +02:00 коммит произвёл Rui Marinho
Родитель b25ca40edb
Коммит 9ffa2f12c7
1 изменённых файлов: 24 добавлений и 16 удалений

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

@ -1,5 +1,6 @@
using Gtk;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Platform.GTK.Extensions;
@ -82,26 +83,33 @@ namespace Xamarin.Forms.Platform.GTK.Renderers
return Container.GetDesiredSize(widthConstraint, heightConstraint);
}
public override void Dispose()
{
base.Dispose();
public override void Dispose()
{
base.Dispose();
if (!_disposed)
{
if (_appeared)
{
Page.SendDisappearing();
}
if (!_disposed)
{
if (_appeared)
{
ReadOnlyCollection<Element> children = ((IElementController)Element).LogicalChildren;
for (var i = 0; i < children.Count; i++)
{
var visualChild = children[i] as VisualElement;
visualChild?.Cleanup();
}
_appeared = false;
Page.SendDisappearing();
}
Dispose(true);
_appeared = false;
_disposed = true;
}
}
Dispose(true);
protected override void OnShown()
_disposed = true;
}
}
protected override void OnShown()
{
base.OnShown();
@ -125,7 +133,7 @@ namespace Xamarin.Forms.Platform.GTK.Renderers
_appeared = false;
PageController.SendDisappearing();
PageController.SendDisappearing();
}
protected override void OnSizeAllocated(Gdk.Rectangle allocation)