public void Dispose() { if (_disposed) { return; } _disposed = true; _currentTiming = CurrentFrameTiming.OutOfFrameLoop; Layers.AbortAllLayers(); TimingPoints.AbortAllEvents(); Lights.Release(); ContextAssociatedMemorySafety.EnsureCollect(OwnerScreen); // Must be called before the opengl context is deleted. Disposed?.Invoke(); }