CString异常导致程序崩溃 求救!在线等待解决在加分
程序流程是去读一个动态变化的文本文件,然后去分析文本字符串,插入远程数据库.
程序不定时的报告:程序发生未知错误,请与软件供应商联系.
在vc6中调试:
报告:一个无效的句柄连接(an access unhandle 0x0000005)
并定位到了:
strcore.cpp文件(MFC自带的)的这个函数中:
const CString& CString::operator=(const CString& stringSrc)
{
if (m_pchData != stringSrc.m_pchData)
{
if ((GetData()->nRefs < 0 && GetData() != _afxDataNil) ||
stringSrc.GetData()->nRefs < 0)///////定位到了这一行
{
// actual copy necessary since one of the strings is locked
AssignCopy(stringSrc.GetData()->nDataLength, stringSrc.m_pchData);
}
else
{
// can just copy references around
Release();
ASSERT(stringSrc.GetData() != _afxDataNil);
m_pchData = stringSrc.m_pchData;
InterlockedIncrement(&GetData()->nRefs);
}
}
return *this;
}
请问高人是什么原因造成的???????求大家帮忙了.