Properly dispose of the prototype renderer.
This commit is contained in:
parent
fe75391962
commit
1e5561c1a8
|
@ -79,6 +79,8 @@ namespace Ooui.Forms.Renderers
|
||||||
|
|
||||||
if (disposing && !_disposed) {
|
if (disposing && !_disposed) {
|
||||||
|
|
||||||
|
ClearPrototype();
|
||||||
|
|
||||||
if (Element != null) {
|
if (Element != null) {
|
||||||
var templatedItems = TemplatedItemsView.TemplatedItems;
|
var templatedItems = TemplatedItemsView.TemplatedItems;
|
||||||
templatedItems.CollectionChanged -= OnCollectionChanged;
|
templatedItems.CollectionChanged -= OnCollectionChanged;
|
||||||
|
@ -89,6 +91,17 @@ namespace Ooui.Forms.Renderers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearPrototype()
|
||||||
|
{
|
||||||
|
if (_prototype != null)
|
||||||
|
{
|
||||||
|
var element = _prototype.Element;
|
||||||
|
element?.ClearValue(Platform.RendererProperty);
|
||||||
|
_prototype?.Dispose();
|
||||||
|
_prototype = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnCollectionChanged (object sender, NotifyCollectionChangedEventArgs e)
|
private void OnCollectionChanged (object sender, NotifyCollectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
UpdateItems ();
|
UpdateItems ();
|
||||||
|
|
Loading…
Reference in New Issue