File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,15 @@ public void Dispose()
64
64
_logger . LogTrace ( "Disposing SQLite cache database at {SqliteCacheDbPath}" , _config . CachePath ) ;
65
65
66
66
// Dispose the timer first, because it might still access other things until it's been disposed!
67
- _cleanupTimer ? . Dispose ( ) ;
67
+ if ( _cleanupTimer is not null )
68
+ {
69
+ // Timer.Dispose(WaitHandle) ends up delegating to (the internal)
70
+ // TimerQueueTimer.Dispose(WaitHandle), which calls (the private)
71
+ // EventWaitHandle.Set(SafeWaitHandle) method, which is just a wrapper around Kernel32's
72
+ // SetEvent() -- all of which is to say, we can't use a ManualResetEventSlim here.
73
+ using var resetEvent = new ManualResetEvent ( false ) ;
74
+ _cleanupTimer . Dispose ( resetEvent . WaitHandle ) ;
75
+ }
68
76
Commands . Dispose ( ) ;
69
77
70
78
_logger . LogTrace ( "Closing connection to SQLite database at {SqliteCacheDbPath}" , _config . CachePath ) ;
You can’t perform that action at this time.
0 commit comments