From b61a3cae2b1c499dad7677925c2b6a17aec4db3f Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Mon, 14 Jan 2008 23:49:01 +0000 Subject: [PATCH] Wallpaper around nsTreeSelection apparently lying about how big the selection is b=412268 r=Standard8 sr=bienvenu git-svn-id: svn://10.0.0.236/trunk@243079 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/base/src/nsMsgDBView.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mozilla/mailnews/base/src/nsMsgDBView.cpp b/mozilla/mailnews/base/src/nsMsgDBView.cpp index 559148b2281..44f6966fbeb 100644 --- a/mozilla/mailnews/base/src/nsMsgDBView.cpp +++ b/mozilla/mailnews/base/src/nsMsgDBView.cpp @@ -1102,6 +1102,7 @@ nsresult nsMsgDBView::GetSelectedIndices(nsUInt32Array *selection) { if (mTreeSelection) { + PRInt32 viewSize = GetSize(); PRInt32 count; mTreeSelection->GetCount(&count); selection->SetSize(count); @@ -1110,17 +1111,17 @@ nsresult nsMsgDBView::GetSelectedIndices(nsUInt32Array *selection) nsresult rv = mTreeSelection->GetRangeCount(&selectionCount); for (PRInt32 i = 0; i < selectionCount; i++) { - PRInt32 startRange; - PRInt32 endRange; - rv = mTreeSelection->GetRangeAt(i, &startRange, &endRange); - NS_ENSURE_SUCCESS(rv, NS_OK); - PRInt32 viewSize = GetSize(); + PRInt32 startRange = -1; + PRInt32 endRange = -1; + mTreeSelection->GetRangeAt(i, &startRange, &endRange); if (startRange >= 0 && startRange < viewSize) { for (PRInt32 rangeIndex = startRange; rangeIndex <= endRange && rangeIndex < viewSize; rangeIndex++) selection->SetAt(count++, rangeIndex); } } + NS_ASSERTION(selection->GetSize() == count, "selection count is wrong"); + selection->SetSize(count); } else {