调试断言失败CScrollView

时间:2016-03-01 21:47:46

标签: c++ mfc

我最近将一个旧的MFC(多线程)项目从VS6移植到VS 2015.该项目似乎已编译但是当我通过GUI启动操作时,我得到“Debug Assertion Failed”

  

程序:C:\ windows \ system32 \ mfc140d.dll文件:   f:\ dd \ vctools \ vc7libs \ ship \ atlmfc \ src \ mfc \ wincore.cpp行:962

然后调试会话在以下代码

处中断
#ifdef _DEBUG
void CFT100View::AssertValid() const
{
    CScrollView::AssertValid();
}

这是我第一次使用C ++和MFC。我非常感谢任何帮助解决这个问题。

我跟着调用堆栈。 AssertValid最终进入wincore.cpp。在为wincore.cpp加载符号后,我发现它写在断言失败的下方的注释中。

    // Note: if either of the above asserts fire and you are
    // writing a multithreaded application, it is likely that
    // you have passed a C++ object from one thread to another
    // and have used that object in a way that was not intended.
    // (only simple inline wrapper functions should be used)
    //
    // In general, CWnd objects should be passed by HWND from
    // one thread to another.  The receiving thread can wrap
    // the HWND with a CWnd object by using CWnd::FromHandle.
    //
    // It is dangerous to pass C++ objects from one thread to
    // another, unless the objects are designed to be used in
    // such a manner.

0 个答案:

没有答案