fix assertions deleting top level msg in a collapsed thread, part of work on 211289, r/sr/a=sspitzer
git-svn-id: svn://10.0.0.236/trunk@145918 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
05a56dac8d
commit
cc8a899283
@ -369,6 +369,7 @@ protected:
|
||||
// last classification callback happens
|
||||
nsCString mLastJunkUriInBatch;
|
||||
PRUint8 mOutstandingJunkBatches;
|
||||
nsUInt32Array mIndicesToNoteChange;
|
||||
|
||||
protected:
|
||||
static nsresult InitDisplayFormats();
|
||||
@ -384,7 +385,6 @@ private:
|
||||
nsresult PerformActionOnJunkMsgs();
|
||||
nsresult SaveJunkMsgForAction(nsIMsgIncomingServer *aServer, const char *aMsgURI, nsMsgJunkStatus aClassification);
|
||||
|
||||
nsUInt32Array mIndicesToNoteChange;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -637,22 +637,22 @@ NS_IMETHODIMP nsMsgThreadedDBView::OnParentChanged (nsMsgKey aKeyChanged, nsMsgK
|
||||
nsMsgViewIndex childIndex = FindViewIndex(aKeyChanged);
|
||||
if (childIndex != nsMsgViewIndex_None)
|
||||
{
|
||||
nsMsgViewIndex parentIndex = FindViewIndex(newParent);
|
||||
PRInt32 newParentLevel = (parentIndex == nsMsgViewIndex_None) ? -1 : m_levels[parentIndex];
|
||||
nsMsgViewIndex oldParentIndex = FindViewIndex(oldParent);
|
||||
PRInt32 oldParentLevel = (oldParentIndex != nsMsgViewIndex_None || newParent == nsMsgKey_None)
|
||||
? m_levels[oldParentIndex] : -1 ;
|
||||
nsMsgViewIndex parentIndex = FindViewIndex(newParent);
|
||||
PRInt32 newParentLevel = (parentIndex == nsMsgViewIndex_None) ? -1 : m_levels[parentIndex];
|
||||
nsMsgViewIndex oldParentIndex = FindViewIndex(oldParent);
|
||||
PRInt32 oldParentLevel = (oldParentIndex != nsMsgViewIndex_None || newParent == nsMsgKey_None)
|
||||
? m_levels[oldParentIndex] : -1 ;
|
||||
PRInt32 levelChanged = m_levels[childIndex];
|
||||
PRInt32 parentDelta = oldParentLevel - newParentLevel;
|
||||
m_levels[childIndex] = (newParent == nsMsgKey_None) ? 0 : newParentLevel + 1;
|
||||
if (parentDelta > 0)
|
||||
{
|
||||
for (nsMsgViewIndex viewIndex = childIndex + 1; viewIndex < GetSize() && m_levels[viewIndex] > levelChanged; viewIndex++)
|
||||
{
|
||||
m_levels[viewIndex] = m_levels[viewIndex] - parentDelta;
|
||||
NoteChange(viewIndex, 1, nsMsgViewNotificationCode::changed);
|
||||
}
|
||||
}
|
||||
PRInt32 parentDelta = oldParentLevel - newParentLevel;
|
||||
m_levels[childIndex] = (newParent == nsMsgKey_None) ? 0 : newParentLevel + 1;
|
||||
if (parentDelta > 0)
|
||||
{
|
||||
for (nsMsgViewIndex viewIndex = childIndex + 1; viewIndex < GetSize() && m_levels[viewIndex] > levelChanged; viewIndex++)
|
||||
{
|
||||
m_levels[viewIndex] = m_levels[viewIndex] - parentDelta;
|
||||
NoteChange(viewIndex, 1, nsMsgViewNotificationCode::changed);
|
||||
}
|
||||
}
|
||||
NoteChange(childIndex, 1, nsMsgViewNotificationCode::changed);
|
||||
}
|
||||
}
|
||||
@ -799,6 +799,7 @@ nsresult nsMsgThreadedDBView::RemoveByIndex(nsMsgViewIndex index)
|
||||
flag |= MSG_FLAG_ELIDED;
|
||||
}
|
||||
m_flags[index] = flag;
|
||||
mIndicesToNoteChange.RemoveElement(index);
|
||||
}
|
||||
else
|
||||
NS_ASSERTION(PR_FALSE, "couldn't find thread child");
|
||||
|
||||
@ -255,6 +255,20 @@ void nsUInt32Array::SetAtGrow(PRUint32 nIndex, PRUint32 newElement)
|
||||
m_pData[nIndex] = newElement;
|
||||
}
|
||||
|
||||
PRBool nsUInt32Array:: RemoveElement(PRUint32 element)
|
||||
{
|
||||
for (PRUint32 i = 0; i < GetSize(); i++)
|
||||
{
|
||||
if ((PRUint32)(m_pData[i]) == element)
|
||||
{
|
||||
RemoveAt(i, 1);
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void nsUInt32Array::CopyArray(nsUInt32Array *oldA)
|
||||
|
||||
@ -36,54 +36,54 @@
|
||||
class NS_MSG_BASE nsUInt32Array
|
||||
{
|
||||
public:
|
||||
// Construction/destruction
|
||||
nsUInt32Array();
|
||||
virtual ~nsUInt32Array();
|
||||
|
||||
// State/attribute member functions
|
||||
PRUint32 GetSize() const;
|
||||
PRBool SetSize(PRUint32 nNewSize, PRBool AdjustGrowth=PR_FALSE, PRUint32 nGrowBy = 0);
|
||||
// Construction/destruction
|
||||
nsUInt32Array();
|
||||
virtual ~nsUInt32Array();
|
||||
|
||||
// State/attribute member functions
|
||||
PRUint32 GetSize() const;
|
||||
PRBool SetSize(PRUint32 nNewSize, PRBool AdjustGrowth=PR_FALSE, PRUint32 nGrowBy = 0);
|
||||
PRBool AllocateSpace(PRUint32 nNewSize) {
|
||||
if (nNewSize == 0) return PR_TRUE;
|
||||
PRUint32 saveSize = m_nSize;
|
||||
nsresult rv = SetSize(nNewSize);
|
||||
m_nSize = saveSize;
|
||||
return rv;
|
||||
};
|
||||
|
||||
// Accessor member functions
|
||||
PRUint32 &ElementAt(PRUint32 nIndex);
|
||||
PRUint32 GetAt(PRUint32 nIndex) const;
|
||||
PRUint32 *GetData();
|
||||
void SetAt(PRUint32 nIndex, PRUint32 newElement);
|
||||
|
||||
// Insertion/deletion member functions
|
||||
PRUint32 Add(PRUint32 newElement);
|
||||
PRUint32 Add(PRUint32 *elementPtr, PRUint32 numElements);
|
||||
void InsertAt(PRUint32 nIndex, PRUint32 newElement, PRUint32 nCount = 1);
|
||||
void InsertAt(PRUint32 nStartIndex, const nsUInt32Array *pNewArray);
|
||||
void RemoveAll();
|
||||
void RemoveAt(PRUint32 nIndex, PRUint32 nCount = 1);
|
||||
void SetAtGrow(PRUint32 nIndex, PRUint32 newElement);
|
||||
|
||||
// Sorting member functions
|
||||
void QuickSort(int (* PR_CALLBACK compare) (const void *elem1, const void *elem2, void *) = NULL);
|
||||
|
||||
// Overloaded operators
|
||||
PRUint32 operator[](PRUint32 nIndex) const { return GetAt(nIndex); }
|
||||
PRUint32 &operator[](PRUint32 nIndex) { return ElementAt(nIndex); }
|
||||
|
||||
// Miscellaneous member functions
|
||||
PRUint32 *CloneData();
|
||||
void CopyArray(nsUInt32Array *oldA);
|
||||
void CopyArray(nsUInt32Array &oldA);
|
||||
|
||||
if (nNewSize == 0) return PR_TRUE;
|
||||
PRUint32 saveSize = m_nSize;
|
||||
nsresult rv = SetSize(nNewSize);
|
||||
m_nSize = saveSize;
|
||||
return rv;
|
||||
};
|
||||
|
||||
// Accessor member functions
|
||||
PRUint32 &ElementAt(PRUint32 nIndex);
|
||||
PRUint32 GetAt(PRUint32 nIndex) const;
|
||||
PRUint32 *GetData();
|
||||
void SetAt(PRUint32 nIndex, PRUint32 newElement);
|
||||
|
||||
// Insertion/deletion member functions
|
||||
PRUint32 Add(PRUint32 newElement);
|
||||
PRUint32 Add(PRUint32 *elementPtr, PRUint32 numElements);
|
||||
void InsertAt(PRUint32 nIndex, PRUint32 newElement, PRUint32 nCount = 1);
|
||||
void InsertAt(PRUint32 nStartIndex, const nsUInt32Array *pNewArray);
|
||||
void RemoveAll();
|
||||
void RemoveAt(PRUint32 nIndex, PRUint32 nCount = 1);
|
||||
void SetAtGrow(PRUint32 nIndex, PRUint32 newElement);
|
||||
PRBool RemoveElement(PRUint32 element);
|
||||
// Sorting member functions
|
||||
void QuickSort(int (* PR_CALLBACK compare) (const void *elem1, const void *elem2, void *) = NULL);
|
||||
|
||||
// Overloaded operators
|
||||
PRUint32 operator[](PRUint32 nIndex) const { return GetAt(nIndex); }
|
||||
PRUint32 &operator[](PRUint32 nIndex) { return ElementAt(nIndex); }
|
||||
|
||||
// Miscellaneous member functions
|
||||
PRUint32 *CloneData();
|
||||
void CopyArray(nsUInt32Array *oldA);
|
||||
void CopyArray(nsUInt32Array &oldA);
|
||||
|
||||
protected:
|
||||
// Member data
|
||||
PRUint32 m_nSize;
|
||||
PRUint32 m_nMaxSize;
|
||||
PRUint32 m_nGrowBy;
|
||||
PRUint32* m_pData;
|
||||
// Member data
|
||||
PRUint32 m_nSize;
|
||||
PRUint32 m_nMaxSize;
|
||||
PRUint32 m_nGrowBy;
|
||||
PRUint32* m_pData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user