Revert "Non-null disposed BlockingCollection can throw exception"
This reverts commit ba722487d8.
This commit is contained in:
parent
1a74736115
commit
6411d23744
1 changed files with 2 additions and 7 deletions
|
|
@ -79,13 +79,8 @@ namespace FileManager
|
|||
//Stop raising events
|
||||
fileSystemWatcher?.Dispose();
|
||||
|
||||
try
|
||||
{
|
||||
//Calling CompleteAdding() will cause background scanner to terminate.
|
||||
directoryChangesEvents?.CompleteAdding();
|
||||
}
|
||||
// if directoryChangesEvents is non-null and isDisposed, this exception is thrown. there's no other way to check >:(
|
||||
catch (ObjectDisposedException) { }
|
||||
//Calling CompleteAdding() will cause background scanner to terminate.
|
||||
directoryChangesEvents?.CompleteAdding();
|
||||
|
||||
//Wait for background scanner to terminate before reinitializing.
|
||||
backgroundScanner?.Wait();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue