File:dbgheap.c求助!!!
程序在Debug中运行关闭后有如下提示:
Debug Assertion Failed!
File:dbgheap.c
Line:1044
Expression:_CrtIsValidHeapPointer(pUserData)
在Realease中正常,我的程序在FrameWnd中有创建了一个带View的FrameWnd,只要程序这个View一创建,关闭程序后就出现如上提示,不知道是怎么回事?怎样才能避免如上提示?
谢谢!
问题点数:100、回复次数:7Top
1 楼hateMonday(天行)回复于 2004-12-01 20:17:39 得分 0
自己顶顶Top
2 楼EnochShen(小疯子:真的好菜—知耻而后勇!)回复于 2004-12-01 20:37:27 得分 50
你的那个VIEW怎么创建的?这个样子试试
m_pShellListView = (CShellListView*)RUNTIME_CLASS(CShellListView)->CreateObject();
if(m_pShellListView == NULL)
{
return -1;
}
if(!m_pShellListView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
return -1;
}
Top
3 楼vcleaner(我没当大哥很久了.......)回复于 2004-12-02 09:22:37 得分 0
如果可以的话,可以将程序发到:xia_qingqi@broadxent.com.cn
我帮你看看!注明帖子的URL!
Top
4 楼danyueer(淡月儿:从此以后,各人得各人的眼泪罢了)回复于 2004-12-02 09:30:20 得分 10
/*
* If this ASSERT fails, a bad pointer has been passed in. It may be
* totally bogus, or it may have been allocated from another heap.
* The pointer MUST come from the 'local' heap.
*/
_ASSERTE(_CrtIsValidHeapPointer(pUserData));
// From dbgheap.cTop
5 楼danyueer(淡月儿:从此以后,各人得各人的眼泪罢了)回复于 2004-12-02 09:33:39 得分 40
根据dbgheap.c里面的代码注释,我们知道断言错误是_free_dbg_lk()这个函数造成的,原因是传入了无效的指针。
原因估计是由于你的FrameWnd里面有控件在销毁的时候没有释放资源,或者你用了控件数组却没管理好。Top
6 楼hateMonday(天行)回复于 2004-12-02 20:08:30 得分 0
我在CMainFrame中
=======================================================
if (!m_wndSplitter.CreateStatic(this, 1, 2))
return FALSE;
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CMyFrame1), CSize(250, 100), pContext) ||
!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CMyFrame2), CSize(200, 100), pContext))
{
m_wndSplitter.DestroyWindow();
return FALSE;
}
====================================================================
在MyFrame1和MyFrame2中分别Create了两个View,方法如下:
====================================================================
if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}Top
7 楼hateMonday(天行)回复于 2004-12-02 21:56:34 得分 0
问题解决了
我将m_wndView改为m_pView然后new一个m_pView再Create就没事了Top




