OpenCvSharp.Window.Dispose C# (CSharp) Method

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed. ///
return void
        protected override void Dispose(bool disposing)
        {
            if (!disposed)
            {
                try
                {
                    if (disposing)
                    {
                        foreach (KeyValuePair<string, CvTrackbar> pair in trackbars)
                        {
                            if (pair.Value != null)
                            {
                                pair.Value.Dispose();
                            }
                        }

                        if (Windows.ContainsKey("name"))
                            Windows.Remove(name);

                        if (callbackHandle != null && callbackHandle.IsAllocated)
                        {
                            callbackHandle.Dispose();
                        }
                    }
                    NativeMethods.highgui_destroyWindow(name);
                    disposed = true;
                }
                finally
                {
                    base.Dispose(disposing);
                }
            }
        }