コード例 #1
0
        public void Using_load_or_cancel_after_dispose_throws()
        {
            var loader = new AsyncLoader();

            // Safe to dispose multiple times
            loader.Dispose();
            loader.Dispose();
            loader.Dispose();

            // Any use after dispose should throw
            Assert.ThrowsAsync <ObjectDisposedException>(async() => await loader.LoadAsync(() => { }, () => { }));
            Assert.ThrowsAsync <ObjectDisposedException>(async() => await loader.LoadAsync(() => 1, i => { }));
            Assert.ThrowsAsync <ObjectDisposedException>(async() => await loader.LoadAsync(_ => { }, () => { }));
            Assert.ThrowsAsync <ObjectDisposedException>(async() => await loader.LoadAsync(_ => 1, i => { }));
            Assert.Throws <ObjectDisposedException>(() => loader.Cancel());
        }
コード例 #2
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _remoteLoader.Dispose();
                components?.Dispose();
            }

            base.Dispose(disposing);
        }
コード例 #3
0
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         CancelBranchNameLoad();
         _branchNameLoader?.Dispose();
         components?.Dispose();
     }
     base.Dispose(disposing);
 }
コード例 #4
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _branchesLoader.Cancel();
                _branchesLoader.Dispose();

                components?.Dispose();
            }
            base.Dispose(disposing);
        }
コード例 #5
0
ファイル: BlameControl.cs プロジェクト: qfz9527/gitextensions
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (components != null)
         {
             components.Dispose();
         }
         blameLoader.Dispose();
     }
     base.Dispose(disposing);
 }
コード例 #6
0
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         _remoteBranchesLoader.Cancel();
         _remoteBranchesLoader.Dispose();
         if (components != null)
         {
             components.Dispose();
         }
     }
     base.Dispose(disposing);
 }
コード例 #7
0
ファイル: FormClone.cs プロジェクト: xatazch/gitextensions
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _branchListLoader.Cancel();

                _branchListLoader.Dispose();

                if (components != null)
                    components.Dispose();
            }
            base.Dispose(disposing);
        }
コード例 #8
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _asyncLoader.Dispose();
                _filterRevisionsHelper.Dispose();
                _filterBranchHelper.Dispose();
                _formBrowseMenus.Dispose();

                components?.Dispose();
            }

            base.Dispose(disposing);
        }
コード例 #9
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _branchListLoader.Dispose();

                if (components is not null)
                {
                    components.Dispose();
                }
            }

            base.Dispose(disposing);
        }
コード例 #10
0
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         CancelBranchNameLoad();
         if (_branchNameLoader != null)
         {
             _branchNameLoader.Dispose();
         }
         if (components != null)
         {
             components.Dispose();
         }
     }
     base.Dispose(disposing);
 }
コード例 #11
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _asyncLoader.Dispose();

                // if the form was instantiated by the translation app, all of the following would be null
                _filterRevisionsHelper?.Dispose();
                _filterBranchHelper?.Dispose();
                _formBrowseMenus?.Dispose();

                components?.Dispose();
            }

            base.Dispose(disposing);
        }
コード例 #12
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _asyncLoader.Cancel();
                _asyncLoader.Dispose();
                _filterRevisionsHelper.Dispose();
                _filterBranchHelper.Dispose();

                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }
コード例 #13
0
 public void TearDown()
 {
     _loader.Dispose();
 }