diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-09-27 17:59:51 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-09-27 17:59:51 +0300 |
| commit | 79be5ab4903b98e2960913d7b07ec49d14410b27 (patch) | |
| tree | c712fd78306851abb56a979718d4ae79bbb487a7 /Software/Visual_Studio/Tango.CSV | |
| parent | 5c07f82c9690ca53928a9489eba7bb88f1352f8d (diff) | |
| download | Tango-79be5ab4903b98e2960913d7b07ec49d14410b27.tar.gz Tango-79be5ab4903b98e2960913d7b07ec49d14410b27.zip | |
Working on RML module.
Fixed issue with CSV trying to add rows after dispose was called.
Diffstat (limited to 'Software/Visual_Studio/Tango.CSV')
| -rw-r--r-- | Software/Visual_Studio/Tango.CSV/CsvFile.cs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Software/Visual_Studio/Tango.CSV/CsvFile.cs b/Software/Visual_Studio/Tango.CSV/CsvFile.cs index 8a908b6d8..d180f0139 100644 --- a/Software/Visual_Studio/Tango.CSV/CsvFile.cs +++ b/Software/Visual_Studio/Tango.CSV/CsvFile.cs @@ -19,6 +19,8 @@ namespace Tango.CSV /// <seealso cref="System.IDisposable" /> public class CsvFile : IDisposable { + protected bool _is_disposed; + internal protected Stream BaseStream; protected static DateTime DateTimeZero = new DateTime(); @@ -190,6 +192,7 @@ namespace Tango.CSV { if (disposing) { + _is_disposed = true; // free managed resources addAsyncTask.Wait(); if (csvLinesToWrite != null) @@ -243,15 +246,17 @@ namespace Tango.CSV /// <param name="record">The record.</param> public void Append(T record) { - if (CsvFile.UseTasks) { var linesWaiting = Interlocked.Increment(ref this.linesToWrite); Action<Task> addRecord = (t) => { - var csvLine = this.ToCsv(record); - this.csvLinesToWrite.Add(csvLine); + if (!_is_disposed) + { + var csvLine = this.ToCsv(record); + this.csvLinesToWrite.Add(csvLine); + } }; if (linesWaiting < 10000) |
