From f969fc6d888c215adc594af453a513b403d992ed Mon Sep 17 00:00:00 2001 From: Giduac Date: Fri, 20 Dec 2024 21:51:16 +0100 Subject: [PATCH] 1908-V100-KDGV-Column-indicator-image-class-update Removal of the ReaderWriterSlimLock didn't make into the commit. --- .../KryptonDataGridViewCellIndicatorImage.cs | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewCellIndicatorImage.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewCellIndicatorImage.cs index 73decf4f9..b4ef53300 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewCellIndicatorImage.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewCellIndicatorImage.cs @@ -21,8 +21,6 @@ internal class KryptonDataGridViewCellIndicatorImage : IDisposable private int _size; // Datagridview the column belongs to. private KryptonDataGridView? _dataGridView; - // Concurrency lock - private ReaderWriterLockSlim _rwls; // State of disposal private bool _disposed = false; @@ -39,7 +37,6 @@ internal class KryptonDataGridViewCellIndicatorImage : IDisposable public KryptonDataGridViewCellIndicatorImage(int imageSize = 14) { _size = imageSize; - _rwls = new(); UpdateCellIndicatorImage(true); KryptonManager.GlobalPaletteChanged += OnKryptonManagerGlobalPaletteChanged; @@ -78,17 +75,7 @@ public KryptonDataGridView? DataGridView /// /// Cell indicator image. /// - public virtual Image? Image - { - get - { - _rwls.EnterReadLock(); - var image = _image?.Clone() as Image; - _rwls.ExitReadLock(); - - return image; - } - } + public virtual Image? Image => _image; /// > public void Dispose() @@ -144,18 +131,12 @@ private void UpdateCellIndicatorImage(bool updateFromKryptonManager) { if (updateFromKryptonManager) { - _rwls.EnterWriteLock(); - // Probably the case used most, so first to check. _image = KryptonManager.CurrentGlobalPalette.GetGalleryButtonImage(_paletteRibbonGalleryButton, _paletteState)!; ResizeCellIndicatorImage(); - - _rwls.ExitWriteLock(); } else if (DataGridView is KryptonDataGridView dataGridView) { - _rwls.EnterWriteLock(); - if (dataGridView.Palette is not null && dataGridView.PaletteMode == PaletteMode.Custom) { // The grid has a custom palette instance assigned to it and PaletteMode is Custom @@ -170,8 +151,6 @@ private void UpdateCellIndicatorImage(bool updateFromKryptonManager) } ResizeCellIndicatorImage(); - - _rwls.ExitWriteLock(); } }