Microsoft.R.Editor.Tree.TreeUpdateTask.Dispose C# (CSharp) Method

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void
        protected override void Dispose(bool disposing) {
            if (Thread.CurrentThread.ManagedThreadId != _ownerThreadId)
                throw new ThreadStateException("Method should only be called on the main thread");

            lock (_disposeLock) {
                if (disposing) {
                    Cancel();

                    _disposed = true;
                    if (_shell != null) {
                        _shell.Idle -= OnIdle;
                    }
                }
                base.Dispose(disposing);
            }
        }
        #endregion

Usage Example

Example #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (TextBuffer != null)
                {
                    if (Closing != null)
                    {
                        Closing(this, null);
                    }

                    if (TreeUpdateTask != null)
                    {
                        TreeUpdateTask.Dispose();
                        TreeUpdateTask = null;
                    }

                    if (TreeLock != null)
                    {
                        TreeLock.Dispose();
                        TreeLock = null;
                    }

                    TextBuffer.ChangedHighPriority -= OnTextBufferChanged;
                    TextBuffer = null;
                }
            }
        }