|
-
March 17th, 2004, 03:02 PM
#1
CArray asserts at program end
Hi!
I have an assertion when my application ends. I can track it to when the clean up is being done on my CArray. I fill the array using the SetAtGrow() function...Setting at each enumeration.
m_aryVals.SetSize(nSysConfigDefault);
typeValues temp;
temp.strText = "Channel";
temp.nType = nSysConfigTitle;
temp.nCol = 0;
temp.nRow = 0;
temp.lColor = ColorBlack;
temp.bBold = TRUE;
temp.nWidth = 55;
m_aryVals.SetAtGrow(nChannelTitle, tempSysConfig);
Where nChannelTitle is an enumerated type from...
enum ESYSCONFIGDISPCELL
{
nChannelTitle,
nInControlTitle,
nChStatusTitle,
nASVersionTitle,
nOSVersionTitle,
nAIPVersionTitle,
nCPUChSumTitle,
nAIPChSumTitle,
nNVMChSumTitle,
nSysConfigDefault
};
The CArray is declared as...
CArray<typeValues,typeValues> m_aryValues;
...where typeValues is as
typedef struct tagValues
{
CString strText;
unsigned long lColor;
BOOL bBold;
int nRow;
int nCol;
int nWidth;
ESYSCONFIGTYPES nType;
}typeValues;
and ESYSCONFIGTYPES is as
enum ESYSCONFIGTYPES
{
nText,
nSysConfigTitle,
nGreenLight,
nGrayLight
};
...It asserts at the code in AFXTEMPL.h at the line
ASSERT(m_nSize <= m_nMaxSize);
and...
m_nSize = 27 and m_nMaxSize = 27
Here's the function where it asserts...
template<class TYPE, class ARG_TYPE>
void CArray<TYPE, ARG_TYPE>::AssertValid() const
{
CObject::AssertValid();
if (m_pData == NULL)
{
ASSERT(m_nSize == 0);
ASSERT(m_nMaxSize == 0);
}
else
{
ASSERT(m_nSize >= 0);
ASSERT(m_nMaxSize >= 0);
ASSERT(m_nSize <= m_nMaxSize);
ASSERT(AfxIsValidAddress(m_pData, m_nMaxSize * sizeof(TYPE)));
}
}
Thanks in advance!
We must become the change we wish to see in our world. ~ Gandhi
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|