attempt to properly unsubscribe the click handler for List cells.

This commit is contained in:
Eric Sink 2018-02-14 21:10:58 -06:00
parent 089186c699
commit 50d6807a95
1 changed files with 11 additions and 0 deletions

View File

@ -48,6 +48,8 @@ namespace Ooui.Forms.Renderers
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
UnsubscribeCellClicks();
base.Dispose(disposing); base.Dispose(disposing);
if (disposing && !_disposed) if (disposing && !_disposed)
@ -56,8 +58,17 @@ namespace Ooui.Forms.Renderers
} }
} }
private void UnsubscribeCellClicks()
{
foreach (var c in _cells)
{
c.Click -= ListItem_Click;
}
}
private void UpdateItems() private void UpdateItems()
{ {
UnsubscribeCellClicks();
_cells.Clear(); _cells.Clear();
var items = TemplatedItemsView.TemplatedItems; var items = TemplatedItemsView.TemplatedItems;