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