class CMilesight_Intelligence_AlgorithmDlg : public CDialogEx
{
public:
CIpCamera *m_ip_camera;//已经定义好的一个类库
}
CMilesight_Intelligence_AlgorithmDlg::CMilesight_Intelligence_AlgorithmDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CMilesight_Intelligence_AlgorithmDlg::IDD, pParent)
{
m_ip_camera = new(CIpCamera);
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
CMilesight_Intelligence_AlgorithmDlg::~CMilesight_Intelligence_AlgorithmDlg()
{
delete m_ip_camera;
}
代码很简单,就是在构造中new一个对象,在析构中释放,调试没有错误,运行时报错
报错信息:
Critical error detected c0000374
Windows 已在 Milesight_Intelligence_Algorithm.exe 中触发一个断点。
其原因可能是堆被损坏,这说明 Milesight_Intelligence_Algorithm.exe 中或它所加载的任何 DLL 中有 Bug。
原因也可能是用户在 Milesight_Intelligence_Algorithm.exe 具有焦点时按下了 F12。
输出窗口可能提供了更多诊断信息。
程序“[8892] Milesight_Intelligence_Algorithm.exe: 本机”已退出,返回值为 0 (0x0)。
错误的堆栈信息:
找了半天,想不出什么原因,是基于对话框的MFC,其APP类我没有动,我只需要在DLG对话框中进行操作。现在只是简单的新建个对象,都能出错!醉了