From: joogab.yun Date: Mon, 6 Mar 2023 05:29:34 +0000 (+0900) Subject: [NUI] Add Dispose to LongPressGestureDetector and modify ReleaseSwigCPtr. X-Git-Tag: submit/tizen/20230306.112015~1^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=52200ec57b532486df27ce6c67fd5d8366b67a33;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add Dispose to LongPressGestureDetector and modify ReleaseSwigCPtr. --- diff --git a/src/Tizen.NUI/src/public/Events/LongPressGestureDetector.cs b/src/Tizen.NUI/src/public/Events/LongPressGestureDetector.cs index 351b80487..b16f72ad1 100755 --- a/src/Tizen.NUI/src/public/Events/LongPressGestureDetector.cs +++ b/src/Tizen.NUI/src/public/Events/LongPressGestureDetector.cs @@ -195,14 +195,45 @@ namespace Tizen.NUI return ret; } - /// This will not be public opened. + /// + /// override it to clean-up your own resources. + /// + /// [EditorBrowsable(EditorBrowsableState.Never)] - protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) + protected override void Dispose(DisposeTypes type) { - if (detectedEventHandler == null && DetectedSignal().Empty() == false) + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (HasBody()) { - DetectedSignal().Disconnect(detectedCallback); + if (detectedCallback != null) + { + using LongPressGestureDetectedSignal signal = new LongPressGestureDetectedSignal(Interop.LongPressGestureDetector.DetectedSignal(GetBaseHandleCPtrHandleRef), false); + signal?.Disconnect(detectedCallback); + detectedCallback = null; + } } + base.Dispose(type); + } + + /// This will not be public opened. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) + { Interop.LongPressGestureDetector.DeleteLongPressGestureDetector(swigCPtr); }