Closed Bug 124783 Opened 22 years ago Closed 6 years ago

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

Categories

(Core :: XUL, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: timeless, Assigned: janv)

Details

Attachments

(1 file)

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 
907

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 
problem.

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
{ 
  NS_ENSURE_ARG_POINTER(numSelected);
    
  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*/
  GetSelectedIndices(&selection);
  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 news.mozilla.org 
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.
I think we should figure out why the range is not deleted.
-> me
Assignee: hewitt → varga
Component: XP Toolkit/Widgets: Trees → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
I don't think anyone is going to work on this given the plan to remove the XUL "tree" widget (bug 1446335).
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: