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
protected override bool ReleaseHandle()
{
- if (!IsInvalid)
+ if (_ownership && !IsInvalid)
{
Interop.VoiceControl.ErrorCode error = VcCmdListDestroy(this.handle, false);
if (error != Interop.VoiceControl.ErrorCode.None)
/// <param name="evt">The ResultEvent</param>
/// <param name="cmdList">Command List</param>
/// <param name="result">Result</param>
- public delegate void RecognitionResultDelegate(ResultEvent evt, VoiceCommandList cmdList, string result);
private static event EventHandler<RecognitionResultEventArgs> _recognitionResult;
private static event EventHandler<StateChangedEventArgs> _stateChanged;