Skip to content

Commit

Permalink
Remove event handlers correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
drewnoakes committed Jul 2, 2019
1 parent e9eedb7 commit 17e10c9
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public void Dispose()
_fileWatcher.EnableRaisingEvents = false;
if (_handler != null)
{
_fileWatcher.Created += _handler;
_fileWatcher.Deleted += _handler;
_fileWatcher.Changed += _handler;
_fileWatcher.Created -= _handler;
_fileWatcher.Deleted -= _handler;
_fileWatcher.Changed -= _handler;
_handler = null;
}
if (_renameHandler != null)
{
_fileWatcher.Renamed += _renameHandler;
_fileWatcher.Renamed -= _renameHandler;
_renameHandler = null;
}
_fileWatcher.Dispose();
Expand Down

0 comments on commit 17e10c9

Please sign in to comment.