错误:wincore.pp中的调试断言失败 [英] Error : debug assertion failed in wincore.pp

查看:108
本文介绍了错误:wincore.pp中的调试断言失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力将扫描程序代码的开发环境从xp迁移到win 7.为此,我已经升级了VS 2008中的代码,所有编译错误都已修复。在发布模式下,代码工作正常。但是在设备中安装应用程序时,它会在遍历时突然崩溃并关闭(使用Esc按钮)。



在调试模式下检查代码时,它抛出一个错误




I am working on migration of development environment of a scanner code from xp to win 7. For that I have upgraded the code in VS 2008, all the compilation errors are fixed. On release mode, the code is working fine. But upon installing the application in the device, it is crashing and closing abruptly on traversing back (using "Esc" button).

Upon checking the code in debug mode, it throws an error


Debug assertion failed!
File: f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp





在尝试调试错误时,它将我重定向到下面提到的代码段:





On trying to debug the error, it redirect me to the code segment mentioned below:

BOOL CWnd::Attach(HWND hWndNew)
{
    ASSERT(m_hWnd == NULL);     // only attach once, detach on destroy
    ASSERT(FromHandlePermanent(hWndNew) == NULL);
        // must not already be in permanent map

    if (hWndNew == NULL)
        return FALSE;

    CHandleMap* pMap = afxMapHWND(TRUE); // create map if not exist
    ASSERT(pMap != NULL);

    pMap->SetPermanent(m_hWnd = hWndNew, this);


#ifndef _AFX_NO_OCC_SUPPORT
    AttachControlSite(pMap);
#endif

    return TRUE;
}





请告诉我如何解决这个问题?是否需要修复任何项目设置?欢迎任何帮助..谢谢



我尝试过:



我试图找到错误的来源,但没有运气..

推荐答案

你必须找到代码调用 Attach()。调用该函数的 Wnd 已经附加( m_hWnd 不是 NULL )或传递的 hWndNew 已经在永久地图中。



调用函数可能是也来自MFC库。如果是这样,你必须找到最终调用MFC函数的代码并检查那里的 CWnd 的状态。



要执行此操作,请在执行因断言而停止时检查调用堆栈。如果不包含来自您的来源的代码,则必须使用断点,直到您知道最终导致断言的代码部分。



我不确定关于这里的副作用(在发布版本中),但猜测它会导致内存泄漏。
You have to find the code that calls Attach(). The Wnd for which the function is called is already attached (m_hWnd not NULL) or the passed hWndNew is already in the permanent map.

The calling function might be also from the MFC library. If so, you have to find your code which finally calls a MFC function and check the state of the CWnd there.

To do this inspect the call stack when execution stops due to the assertion. If that does not include code from your sources, you have to use break points until you know your code portion that finally results in the assertion.

I'm not sure about the side effects here (in release build) but guess that it will result in memory leaks.


这篇关于错误:wincore.pp中的调试断言失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆