Пример #1
0
        public void Dispose(bool collectGarbage = true)
        {
            if (IsDisposed)
            {
                return;
            }

            IsDisposed = true;
            GC.SuppressFinalize(this);

            WeakReference temp;

            if (!ContextRegistry.TryRemove(Pointer, out temp))
            {
                Debug.WriteLine("Failed to remove context from registry");
            }

            if (collectGarbage)
            {
                JSAPI.DestroyContext(Pointer);
            }
            else
            {
                JSAPI.DestroyContextNoGC(Pointer);
            }
        }