}
/// <summary>
+ /// Destructor to destroy a STT instance.
+ /// </summary>
+ ~SttClient()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
/// Event to be invoked when the recognition is done.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
/// <summary>
{
if (!disposedValue)
{
- if (disposing)
- {
- lock (thisLock)
- {
- SttError error = SttDestroy(_handle);
- if (error != SttError.None)
- {
- Log.Error(LogTag, "Destroy Failed with error " + error);
- }
- }
- }
-
- disposedValue = true;
+ lock (thisLock)
+ {
+ if (_handle != IntPtr.Zero)
+ {
+ SttError error = SttDestroy(_handle);
+ if (error != SttError.None)
+ {
+ Log.Error(LogTag, "Destroy Failed with error " + error);
+ }
+ _handle = IntPtr.Zero;
+ }
+ }
+
+ disposedValue = true;
}
}
}
}
/// <summary>
+ /// Destructor to destroy TtsClient handle.
+ /// </summary>
+ ~TtsClient()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
/// Event to be invoked when TTS state changes.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
/// <summary>
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
- {
- if (disposing)
- {
- lock (thisLock)
- {
- TtsError error = TtsDestroy(_handle);
- if (error != TtsError.None)
- {
- Log.Error(LogTag, "Destroy Failed with error " + error);
- }
- }
- }
-
- disposedValue = true;
+ {
+ lock (thisLock)
+ {
+ if (_handle != IntPtr.Zero)
+ {
+ TtsError error = TtsDestroy(_handle);
+ if (error != TtsError.None)
+ {
+ Log.Error(LogTag, "Destroy Failed with error " + error);
+ }
+ _handle = IntPtr.Zero;
+ }
+ }
+
+ disposedValue = true;
}
}
}