After PR #4892 `HasBody()` can be false in `ReleaseSwigCPtr`.
So, some class who check double-released might not release
native memory. It might occure some leak.
This patch make them to check `Disposed` instead of `HasBody()`.
+
Clean up some codes of `ReleaseSwigCPtr`.
TODO : Also need to check `Disposable.Dispose` function
TODO : Need to check third-party library implementation who use
their custom `ReleaseSwigCPtr`
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
protected override void ReleaseSwigCPtr(HandleRef swigCPtr)
{
- if (swigCPtr.Handle == IntPtr.Zero)
- {
- //Log.Fatal("NUI", "Error! NUI.Uint16Pair's native DALi object is already disposed! OR the native DALi object handle of NUI.Uint16Pair's became null by unknown reason!");
- //Log.Fatal("NUI", "Error! just return here! this can cause unknown error or crash in next step");
- //return false;
- throw new InvalidOperationException("Error! NUI.Uint16Pair's native DALi object is already disposed! OR the native DALi object handle of NUI.Uint16Pair's became null by unknown reason!");
- }
Interop.Uint16Pair.DeleteUint16Pair(swigCPtr);
}
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
- if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
+ if (swigCPtr.Handle == IntPtr.Zero || Disposed)
{
- Tizen.Log.Fatal("NUI", $"[ERROR] FadeTransitionItem ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
+ Tizen.Log.Fatal("NUI", $"[ERROR] FadeTransitionItem ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} Disposed={Disposed}");
return;
}
Interop.FadeTransitionItem.Delete(swigCPtr);
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
- if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
+ if (swigCPtr.Handle == IntPtr.Zero || Disposed)
{
- Tizen.Log.Fatal("NUI", $"[ERROR] ScaleTransitionItem ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
+ Tizen.Log.Fatal("NUI", $"[ERROR] ScaleTransitionItem ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} Disposed={Disposed}");
return;
}
Interop.ScaleTransitionItem.Delete(swigCPtr);
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
- if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
+ if (swigCPtr.Handle == IntPtr.Zero || Disposed)
{
- Tizen.Log.Fatal("NUI", $"[ERROR] SlideTransitionItem ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
+ Tizen.Log.Fatal("NUI", $"[ERROR] SlideTransitionItem ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} Disposed={Disposed}");
return;
}
Interop.SlideTransitionItem.Delete(swigCPtr);
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
- if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
+ if (swigCPtr.Handle == IntPtr.Zero || Disposed)
{
- Tizen.Log.Fatal("NUI", $"[ERROR] TransitionItem ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
+ Tizen.Log.Fatal("NUI", $"[ERROR] TransitionItem ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} Disposed={Disposed}");
return;
}
Interop.TransitionItem.Delete(swigCPtr);
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
- if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
+ if (swigCPtr.Handle == IntPtr.Zero || Disposed)
{
- Tizen.Log.Fatal("NUI", $"[ERROR] TransitionItemBase ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
+ Tizen.Log.Fatal("NUI", $"[ERROR] TransitionItemBase ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} Disposed={Disposed}");
return;
}
Interop.TransitionItemBase.Delete(swigCPtr);
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
- if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
+ if (swigCPtr.Handle == IntPtr.Zero || Disposed)
{
- Tizen.Log.Fatal("NUI", $"[ERROR] TransitionSet ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
+ Tizen.Log.Fatal("NUI", $"[ERROR] TransitionSet ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} Disposed={Disposed}");
return;
}
Interop.TransitionSet.Delete(swigCPtr);
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
- if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
+ if (swigCPtr.Handle == IntPtr.Zero || Disposed)
{
- Tizen.Log.Fatal("NUI", $"[ERROR] Animation ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
+ Tizen.Log.Fatal("NUI", $"[ERROR] Animation ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} Disposed={Disposed}");
return;
}
Interop.Animation.DeleteAnimation(swigCPtr);
{
if (finishedEventHandler == null && disposed == false)
{
- finishedSignal = new CaptureSignal(Interop.Capture.Get(SwigCPtr), false);
+ finishedSignal = new CaptureSignal(Interop.Capture.Get(SwigCPtr));
finishedCallback = onFinished;
finishedSignal.Connect(finishedCallback);
}
internal class CaptureSignal : Disposable
{
- internal CaptureSignal(IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ internal CaptureSignal(IntPtr cPtr) : base(cPtr, false)
{
}
protected override void ReleaseSwigCPtr(HandleRef swigCPtr)
{
- if (SwigCMemOwn)
- {
- Interop.Capture.DeleteSignal(swigCPtr);
- }
+ // Do nothing because native didn't create new signal handle.
}
public bool Empty()