From 0effa02be123e3426c0606f00a305fba1bc06225 Mon Sep 17 00:00:00 2001 From: wj32 Date: Sat, 26 Dec 2009 22:06:03 +0000 Subject: [PATCH] fixed multi-threading issues with HighlightedListViewItem git-svn-id: svn://svn.code.sf.net/p/processhacker/code@2512 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- 1.x/trunk/CHANGELOG.txt | 1 + .../UI/HighlightedListViewItem.cs | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/1.x/trunk/CHANGELOG.txt b/1.x/trunk/CHANGELOG.txt index 11e86b6a2..9ac8d7971 100644 --- a/1.x/trunk/CHANGELOG.txt +++ b/1.x/trunk/CHANGELOG.txt @@ -8,6 +8,7 @@ Process Hacker * #2920711 - "Value was either too large or too small for an Int32." * #2920734 - "Found a reproducible bug : Value does not fall within..." * Missing service descriptions in dumps + * Multi-threading issues with highlighting 1.9 * NEW/IMPROVED: diff --git a/1.x/trunk/ProcessHacker/UI/HighlightedListViewItem.cs b/1.x/trunk/ProcessHacker/UI/HighlightedListViewItem.cs index 95f6a5f6b..1c22373c5 100644 --- a/1.x/trunk/ProcessHacker/UI/HighlightedListViewItem.cs +++ b/1.x/trunk/ProcessHacker/UI/HighlightedListViewItem.cs @@ -95,8 +95,11 @@ namespace ProcessHacker.UI // Execute the pre-queue items. _list.BeginUpdate(); - while (_preQueue.Count > 0) - _preQueue.Dequeue().Invoke(); + lock (_preQueue) + { + while (_preQueue.Count > 0) + _preQueue.Dequeue().Invoke(); + } _list.EndUpdate(); @@ -111,8 +114,11 @@ namespace ProcessHacker.UI { _list.BeginUpdate(); - while (_queue.Count > 0) - _queue.Dequeue().Invoke(); + lock (_queue) + { + while (_queue.Count > 0) + _queue.Dequeue().Invoke(); + } _list.EndUpdate(); })); @@ -125,12 +131,14 @@ namespace ProcessHacker.UI public void Enqueue(MethodInvoker method) { - _queue.Enqueue(method); + lock (_queue) + _queue.Enqueue(method); } public void EnqueuePre(MethodInvoker method) { - _preQueue.Enqueue(method); + lock (_preQueue) + _preQueue.Enqueue(method); } public void Dispose()