File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 33using System . Collections . Generic ;
44using System . IO ;
55using System . Threading ;
6+ using LiteDB . Utils ;
67using static LiteDB . Constants ;
78
89namespace LiteDB . Engine
@@ -348,14 +349,16 @@ public void Dispose()
348349 // can change file size
349350 var delete = _logFactory . Exists ( ) && _logPool . Writer . Value . Length == 0 ;
350351
352+ var tc = new TryCatch ( ) ;
353+
351354 // dispose Stream pools
352- _dataPool . Dispose ( ) ;
353- _logPool . Dispose ( ) ;
355+ tc . Catch ( ( ) => _dataPool . Dispose ( ) ) ;
356+ tc . Catch ( ( ) => _logPool . Dispose ( ) ) ;
354357
355- if ( delete ) _logFactory . Delete ( ) ;
358+ if ( delete ) tc . Catch ( ( ) => _logFactory . Delete ( ) ) ;
356359
357360 // other disposes
358- _cache . Dispose ( ) ;
361+ tc . Catch ( ( ) => _cache . Dispose ( ) ) ;
359362 }
360363 }
361364}
You can’t perform that action at this time.
0 commit comments