return;
}
+#if NUI_DEBUG_ON
+ NUILog.Debug($"[Dispose] View.Dispose({type}) START");
+ NUILog.Debug($"[Dispose] type:{GetType()} copyNativeHandle:{GetBaseHandleCPtrHandleRef.Handle.ToString("X8")}");
+ if(HasBody())
+ {
+ NUILog.Debug($"[Dispose] ID:{Interop.Actor.GetId(GetBaseHandleCPtrHandleRef)} Name:{Interop.Actor.GetName(GetBaseHandleCPtrHandleRef)}");
+ }
+ else
+ {
+ NUILog.Debug($"has no native body!");
+ }
+#endif
+
+
//_mergedStyle = null;
if (type == DisposeTypes.Explicit)
view.InternalParent = null;
}
+ NUILog.Debug($"[Dispose] View.Dispose({type}) END");
+ NUILog.Debug($"=============================");
+
base.Dispose(type);
}
private void DisConnectFromSignals()
{
+ if (HasBody() == false)
+ {
+ NUILog.Debug($"[Dispose] DisConnectFromSignals() No native body! No need to Disconnect Signals!");
+ return;
+ }
+ NUILog.Debug($"[Dispose] DisConnectFromSignals START");
+ NUILog.Debug($"[Dispose] View.DisConnectFromSignals() type:{GetType()} copyNativeHandle:{GetBaseHandleCPtrHandleRef.Handle.ToString("X8")}");
+ NUILog.Debug($"[Dispose] ID:{Interop.Actor.GetId(GetBaseHandleCPtrHandleRef)} Name:{Interop.Actor.GetName(GetBaseHandleCPtrHandleRef)}");
+
if (onRelayoutEventCallback != null)
{
+ NUILog.Debug($"[Dispose] onRelayoutEventCallback");
+
using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnRelayoutSignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(onRelayoutEventCallback);
onRelayoutEventCallback = null;
if (offWindowEventCallback != null)
{
+ NUILog.Debug($"[Dispose] offWindowEventCallback");
+
using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOffSceneSignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(offWindowEventCallback);
offWindowEventCallback = null;
if (onWindowEventCallback != null)
{
+ NUILog.Debug($"[Dispose] onWindowEventCallback");
+
using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(onWindowEventCallback);
onWindowEventCallback = null;
if (wheelEventCallback != null)
{
+ NUILog.Debug($"[Dispose] wheelEventCallback");
+
using WheelSignal signal = new WheelSignal(Interop.ActorSignal.ActorWheelEventSignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(wheelEventCallback);
wheelEventCallback = null;
if (WindowWheelEventHandler != null)
{
+ NUILog.Debug($"[Dispose] WindowWheelEventHandler");
+
NUIApplication.GetDefaultWindow().WheelEvent -= OnWindowWheelEvent;
WindowWheelEventHandler = null;
}
if (hoverEventCallback != null)
{
+ NUILog.Debug($"[Dispose] hoverEventCallback");
+
using HoverSignal signal = new HoverSignal(Interop.ActorSignal.ActorHoveredSignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(hoverEventCallback);
hoverEventCallback = null;
if (interceptTouchDataCallback != null)
{
+ NUILog.Debug($"[Dispose] interceptTouchDataCallback");
+
using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorInterceptTouchSignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(interceptTouchDataCallback);
interceptTouchDataCallback = null;
if (touchDataCallback != null)
{
+ NUILog.Debug($"[Dispose] touchDataCallback");
+
using TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.ActorTouchSignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(touchDataCallback);
touchDataCallback = null;
if (ResourcesLoadedCallback != null)
{
+ NUILog.Debug($"[Dispose] ResourcesLoadedCallback");
+
using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(ResourcesLoadedCallback);
ResourcesLoadedCallback = null;
if (keyCallback != null)
{
+ NUILog.Debug($"[Dispose] keyCallback");
+
using ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.KeyEventSignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(keyCallback);
keyCallback = null;
if (keyInputFocusLostCallback != null)
{
+ NUILog.Debug($"[Dispose] keyInputFocusLostCallback");
+
using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusLostSignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(keyInputFocusLostCallback);
keyInputFocusLostCallback = null;
if (keyInputFocusGainedCallback != null)
{
+ NUILog.Debug($"[Dispose] keyInputFocusGainedCallback");
+
using KeyInputFocusSignal signal = new KeyInputFocusSignal(Interop.ViewSignal.KeyInputFocusGainedSignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(keyInputFocusGainedCallback);
keyInputFocusGainedCallback = null;
if (backgroundResourceLoadedCallback != null)
{
+ NUILog.Debug($"[Dispose] backgroundResourceLoadedCallback");
+
using ViewSignal signal = new ViewSignal(Interop.View.ResourceReadySignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(backgroundResourceLoadedCallback);
backgroundResourceLoadedCallback = null;
if (onWindowSendEventCallback != null)
{
+ NUILog.Debug($"[Dispose] onWindowSendEventCallback");
+
using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(GetBaseHandleCPtrHandleRef), false);
signal?.Disconnect(onWindowSendEventCallback);
onWindowSendEventCallback = null;
}
+ NUILog.Debug($"[Dispose] DisConnectFromSignals END");
}
/// <summary>
//A Flag to check who called Dispose(). (By User or DisposeQueue)
private bool isDisposeQueued = false;
+#if NUI_DEBUG_ON
+ private static int debuggingCount = 0;
+#endif
+
/// <summary>
/// Create an instance of BaseHandle.
/// </summary>
//to catch derived classes dali native exceptions
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ NUILog.Debug($"[Dispose] BaseHandle.contructor with cMemeryOwn:{cMemoryOwn} START");
+
registerMe = swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
// using copy constructor to create another native handle so Registry.Unregister works fine.
if (registerMe)
{
-
// Register this instance of BaseHandle in the registry.
Registry.Register(this);
}
+
+#if NUI_DEBUG_ON
+ NUILog.Debug($"[Dispose] type:{GetType()} copyNativeHandle:{swigCPtrCopy.Handle.ToString("X8")}");
+
+ debuggingCount++;
+ if (this is BaseComponents.View view)
+ {
+ NUILog.Debug($"[Dispose] ID:{view.ID} Name:{view.Name} debuggingCount:{debuggingCount}");
+ }
+ NUILog.Debug($"[Dispose] BaseHandle.contructor with cMemeryOwn END");
+ NUILog.Debug($"=============================");
+#endif
}
internal BaseHandle(global::System.IntPtr cPtr)
{
+ NUILog.Debug($"[Dispose] BaseHandle.contructor START");
+
registerMe = swigCMemOwn = true;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
// Register this instance of BaseHandle in the registry.
Registry.Register(this);
}
+
+#if NUI_DEBUG_ON
+ NUILog.Debug($"[Dispose] type:{GetType()} copyNativeHandle:{swigCPtrCopy.Handle.ToString("X8")}");
+
+ debuggingCount++;
+ if (this is BaseComponents.View view)
+ {
+ NUILog.Debug($"[Dispose] ID:{view.ID} Name:{view.Name} debuggingCount:{debuggingCount}");
+ }
+ NUILog.Debug($"[Dispose] BaseHandle.contructor END");
+ NUILog.Debug($"=============================");
+#endif
+
}
/// <summary>
return;
}
+ NUILog.Debug($"[Dispose] BaseHandle.Dispose({type}) START");
+
if (type == DisposeTypes.Explicit)
{
//Called by User
Registry.Unregister(this);
}
+#if NUI_DEBUG_ON
+ debuggingCount--;
+ NUILog.Debug($"[Dispose] swigCMemOwn:{swigCMemOwn} debuggingCount:{debuggingCount} type:{GetType()} copyNativeHandle:{swigCPtrCopy.Handle.ToString("X8")}");
+#endif
+
if (SwigCPtr.Handle != IntPtr.Zero)
{
if (swigCMemOwn)
{
Application.Current.XamlResourceChanged -= OnResourcesChanged;
}
+
+ NUILog.Debug($"[Dispose] BaseHandle.Dispose({type}) END");
+ NUILog.Debug($"=============================");
}
/// <summary>