mPanGestureDetector?.Dispose();
mPanGestureDetector = null;
- ContentContainer?.RemovePropertyNotification(propertyNotification);
+ if(!(ContentContainer?.Disposed ?? true) && propertyNotification != null)
+ {
+ ContentContainer?.RemovePropertyNotification(propertyNotification);
+ }
propertyNotification?.Dispose();
propertyNotification = null;
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.Linq;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Binding;
using Tizen.NUI.Binding.Internals;
public void DisposeRecursively()
{
// To avoid useless "OnChildRemoved" callback invoke, Dispose itself before children.
- if(!Disposed && !IsDisposeQueued)
+ if (!Disposed && !IsDisposeQueued)
{
Dispose();
}
- foreach (View child in Children)
- {
- child.DisposeRecursively();
- }
+ // Copy child referecen to avoid Children changed during DisposeRecursively();
+ var copiedChildren = childViews.ToList();
// Make sure that itself don't have children anymore.
childViews?.Clear();
+
+ foreach (View child in copiedChildren)
+ {
+ if (!(child?.Disposed ?? true))
+ {
+ child.DisposeRecursively();
+ }
+ }
}
/// <summary>