From 9aa31fcc20eeb2a2ff6220805f0e24a27b4eab73 Mon Sep 17 00:00:00 2001 From: wj32 Date: Tue, 22 Sep 2009 07:49:28 +0000 Subject: [PATCH] #2863305 - "Unhandled exception in comparer" git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1909 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- trunk/CHANGELOG.txt | 1 + .../Components/ProcessTree/ProcessTreeModel.cs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/trunk/CHANGELOG.txt b/trunk/CHANGELOG.txt index b2a013a0b..f9120a86a 100644 --- a/trunk/CHANGELOG.txt +++ b/trunk/CHANGELOG.txt @@ -23,6 +23,7 @@ Process Hacker * #2845427 - "Indicator integer overflow" * #2847691 - "Apply button bug" * #2849052 - "not defined by current visual style" + * #2863305 - "Unhandled exception in comparer" * Critical KProcessHacker denial-of-service security issues * Incorrect menu items for System threads * Crash when viewing error details in the event diff --git a/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs b/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs index 4264d4782..745c4d3b8 100644 --- a/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs +++ b/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs @@ -237,6 +237,15 @@ namespace ProcessHacker nodes.Sort(new Comparison(delegate(ProcessNode n1, ProcessNode n2) { + // We have a problem here - the GdiHandlesNumber and UserHandlesNumber + // properties are dynamically retrieved, so if n1 == n2 we may end up + // getting different values for the same process due to the timing. + // If we do, then Array.Sort will throw an exception. + // + // The temporary HACK used here is to return 0 whenever n1 == n2. + if (n1 == n2) + return 0; + switch (sortC) { case "name":