Do not Dispose on finalize (might be already finalized)

This commit is contained in:
Flamefire committed 2014-05-07 00:39:12 +02:00
1 parent c23eaa0834
commit fc278e4ad9
1 file changed
+4 -4
+4 -4
View File
@@ -45,7 +45,7 @@ namespace Vocaluxe.Lib.Sound.Record
~CBuffer()
{
_Dispose();
_Dispose(false);
}
public int GetNumHalfTones()
@@ -110,13 +110,13 @@ namespace Vocaluxe.Lib.Sound.Record
public void Dispose()
{
_Dispose();
_Dispose(true);
GC.SuppressFinalize(this);
}
private void _Dispose()
private void _Dispose(bool disposing)
{
if (_PitchTracker != null)
if (disposing && _PitchTracker != null)
{
_PitchTracker.Dispose();
_PitchTracker = null;