程序运行的时候都正常,但是关闭的时候在这个位置出错:
//dbgheap.c
for (pHead = _pFirstBlock; pHead != NULL; pHead = pHead->pBlockHeaderNext)
{
if (_BLOCK_TYPE(pHead->nBlockUse) >= 0 && _BLOCK_TYPE(pHead->nBlockUse) < _MAX_BLOCKS)
???
//dbgheap.c
for (pHead = _pFirstBlock; pHead != NULL; pHead = pHead->pBlockHeaderNext)
{
if (_BLOCK_TYPE(pHead->nBlockUse) >= 0 && _BLOCK_TYPE(pHead->nBlockUse) < _MAX_BLOCKS)
???
我将所有的delete都写在了C***View的析构函数中
是不是执行完析构后还要调用这些指针呢?
在头文件中定义:
double* ResultS;
double* ResultA;
CString* str1;
CString* str2;
在View的构造函数中赋值:
ResultS = new double[19];
ResultA = new double[6];
str1 = new CString[19];
str2 = new CString[6];
for(int i=0; i<19; i++)
{
str1[i] = _T(" ");
ResultS[i] = 0;
}
for(int i=0; i<6; i++)
{
str2[i] = _T(" ");
ResultA[i] = 0;
}
在析构函数中delete上述四个:
delete []ResultS;
delete []ResultA;
delete []str1;
delete []str2;程序中响应两个菜单的命令,如果只做第一个(只用到ResultS和str1)就关闭程序,没问题
如果做第二个(只用到ResultA和str2),就会出上面的错误
你的程序是公司产品吗?程序大吗?如果你希望的话``可以传给我``我帮你调,[email protected]
不知道为什么,这个世界真奇妙
int* asdfa()
{
int* A;
return A
}
这样的话,这个A怎么delete掉?或者说,需要delete吗?