Count() returns 1 for Min==Max==-1

Assigned to



17 years ago
10 years ago


(Reporter: timeless, Assigned: janv)



Firefox Tracking Flags

(Not tracked)



(1 attachment)



17 years ago
I've experienced this on w2k and fbsd.
###!!! ASSERTION: selected indices is not equal to num of msg selected!!!: 
'numSelected == selection.GetSize()', file 
F:\build\mozilla\mailnews\base\src\nsMsgDBView.cpp, line 907
###!!! Break: at file F:\build\mozilla\mailnews\base\src\nsMsgDBView.cpp, line 

Inline is the top of the callstack + certain variables as seen by msvc + my 
annotations /**/
-	this	0x06b6b3e0
+	mSelection	0x06b38e50
+	mPrev	0x00000000
+	mNext	0x00000000
	mMin	-1
	mMax	-1
nsOutlinerRange::Count() line 208
  PRInt32 Count() {
    PRInt32 total = mMax - mMin + 1; /*total = (-1)-(-1)+1==1*/
    if (mNext) /*0*/
      total += mNext->Count();
    return total; /*1*/

I think PRInt32 total = mMax - mMin + (mMax>=0); would probably solve this 

Up: nsOutlinerSelection::GetCount(nsOutlinerSelection * const 0x06b38e50, int * 
0x0012bf60) line 542 + 11 bytes
NS_IMETHODIMP nsOutlinerSelection::GetCount(PRInt32 *count)
  if (mFirstRange)
    *count = mFirstRange->Count(); /*The code went through here*/
  else // No range available, so there's no selected row.
    *count = 0; /*apparently code could/should have gone through here, which 
means that perhaps something should have deleted firstrange when the length 
reached 0 or not have inited it*/
  return NS_OK;
Up: nsMsgDBView::GetNumSelected(nsMsgDBView * const 0x06ab5e30, unsigned int * 
0x0012bf60) line 4810
  if (!mOutlinerSelection) /*
-	mOutlinerSelection	{...}
+	mRawPtr	0x06b38e50 */
    *numSelected = 0;
    return NS_OK;
  // We call this a lot from the front end JS, so make it fast.
  return mOutlinerSelection->GetCount((PRInt32*)numSelected); /*Code path went 
through here*/

Up: nsMsgDBView::SelectionChanged(nsMsgDBView * const 0x06ab5e38) line 904
NS_IMETHODIMP nsMsgDBView::SelectionChanged()
  // if the currentSelection changed then we have a message to display - not if 
we are in the middle of deleting rows
  if (m_deletingRows)
    return NS_OK;
  PRUint32 numSelected = 0;
  GetNumSelected(&numSelected); /*Callsite*/
  nsMsgViewIndex *indices = selection.GetData();
  NS_ASSERTION(numSelected == selection.GetSize(), "selected indices is not 
equal to num of msg selected!!!"); /*We assert here because numSelected == 1 
and selection.GetSize() == 0 */

Ok, i've cc'd all of the culpable individuals.

I'm not quite sure whom to blame.  Hyatt owns the innermost function, hwaara 
the next and mailnews the next.

As for steps to reproduce, my profiles on fbsd and w2k have 
with various newsgroups, fbsd has npm.perf and reviewers, i think .license was 
the likely active group in w2k.  I'm just silly enough to use debug builds, 
which i suspect on one else does.

Comment 1

17 years ago
Created attachment 68833 [details] [diff] [review]
early return from Count

Comment 2

17 years ago
I think we should figure out why the range is not deleted.

Comment 3

16 years ago
-> me
Assignee: hewitt → varga


10 years ago
Component: XP Toolkit/Widgets: Trees → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.