Review UIX-VOICE-CONTROL API cs files
[platform/core/csapi/uix-voice-control.git] / Tizen.Uix.VoiceControl / Interop / Interop.VoiceControlCommand.cs
index b9ca66e..e9d9bc0 100755 (executable)
@@ -21,12 +21,12 @@ using Tizen;
 using Tizen.Uix.VoiceControl;
 
 /// <summary>
-/// Partial Interop Class
+/// Partial interop class.
 /// </summary>
 internal static partial class Interop
 {
     /// <summary>
-    /// VoiceControlCommand Interop Class
+    /// VoiceControlCommand interop class.
     /// </summary>
     internal static class VoiceControlCommand
     {
@@ -95,14 +95,18 @@ internal static partial class Interop
 
         internal sealed class SafeCommandListHandle : SafeHandle
         {
+            internal bool _ownership;
+
             public SafeCommandListHandle(IntPtr handle)
                 : base(handle, true)
             {
+                _ownership = true;
             }
 
             public SafeCommandListHandle()
                 : base(IntPtr.Zero, true)
             {
+                _ownership = true;
             }
 
             public override bool IsInvalid
@@ -112,7 +116,7 @@ internal static partial class Interop
 
             protected override bool ReleaseHandle()
             {
-                if (!IsInvalid)
+                if (_ownership && !IsInvalid)
                 {
                     Interop.VoiceControl.ErrorCode error = VcCmdListDestroy(this.handle, false);
                     if (error != Interop.VoiceControl.ErrorCode.None)