Last Comment Bug 124783 - Count() returns 1 for Min==Max==-1
: Count() returns 1 for Min==Max==-1
Status: RESOLVED WONTFIX
:
Product: Core
Classification: Components
Component: XUL (show other bugs)
: Trunk
: x86 All
-- normal (vote)
: ---
Assigned To: Jan Varga [:janv]
:
: Neil Deakin (away until Nov 23)
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-02-10 20:06 PST by timeless
Modified: 2018-09-12 00:04 PDT (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
early return from Count (537 bytes, patch)
2002-02-10 20:33 PST, timeless
no flags Details | Diff | Splinter Review

Description User image timeless 2002-02-10 20:06:52 PST
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.
Comment 1 User image timeless 2002-02-10 20:33:40 PST
Created attachment 68833 [details] [diff] [review]
early return from Count
Comment 2 User image Jan Varga [:janv] 2002-02-10 23:24:51 PST
I think we should figure out why the range is not deleted.
Comment 3 User image Jan Varga [:janv] 2002-07-12 23:52:41 PDT
-> me
Comment 4 User image Jan Varga [:janv] 2018-09-12 00:04:56 PDT
I don't think anyone is going to work on this given the plan to remove the XUL "tree" widget (bug 1446335).

Note You need to log in before you can comment on or make changes to this bug.