mirror of
				https://github.com/9ParsonsB/Pulsar.git
				synced 2025-10-30 14:24:57 -04:00 
			
		
		
		
	Handle disposed timer object in ResetTimer() (#104)
I've had this occur a number of times (twice in a row yesterday) where if you receive new records while doing a long read-all, this exception crashes ObsCore. So may need some further digging, but in the meantime, it won't crash here.
This commit is contained in:
		| @@ -22,6 +22,11 @@ namespace Observatory.PluginManagement | ||||
|             this.observatoryNotifiers = observatoryNotifiers; | ||||
|             errorList = new(); | ||||
|  | ||||
|             InitializeTimer(); | ||||
|         } | ||||
|  | ||||
|         private void InitializeTimer() | ||||
|         { | ||||
|             // Use a timer to delay error reporting until incoming errors are "quiet" for one full second. | ||||
|             // Should resolve issue where repeated plugin errors open hundreds of error windows. | ||||
|             timer = new(); | ||||
| @@ -107,8 +112,18 @@ namespace Observatory.PluginManagement | ||||
|         private void ResetTimer() | ||||
|         { | ||||
|             timer.Stop(); | ||||
|             try | ||||
|             { | ||||
|                 timer.Start(); | ||||
|             } | ||||
|             catch (ObjectDisposedException ode) | ||||
|             { | ||||
|                 // Not sure why this happens, but I've reproduced it twice in a row after hitting | ||||
|                 // read-all while also playing (ie. generating journals). | ||||
|                 InitializeTimer(); | ||||
|                 timer.Start(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void RecordError(PluginException ex) | ||||
|         { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user