private void Dispose(bool manual) { if (!IsDisposed) { lock (SyncRoot) { RemoveContext(this); } // Note: we cannot dispose the implementation // from a different thread. See wglDeleteContext. // This is also known to crash GLX implementations. if (manual) { Debug.WriteLine($"Disposing context {(this as IGraphicsContextInternal).Context.ToString()}."); if (implementation != null) { implementation.Dispose(); } } else { Debug.WriteLine("GraphicsContext leaked, did you forget to call Dispose()?"); } IsDisposed = true; } }
void Dispose(bool manual) { if (!IsDisposed) { Debug.Print("Disposing context {0}.", (this as IGraphicsContextInternal).Context.ToString()); lock (SyncRoot) { available_contexts.Remove((this as IGraphicsContextInternal).Context); } if (manual && !IsExternal) { if (implementation != null) { implementation.Dispose(); } } IsDisposed = true; } }