Debug Assertion Failed! 我用VS2008编程,运行时点击菜单选项报错。

2024-11-07 15:21:11
推荐回答(1个)
回答1:

程序里用线程锁CComSafeDeleteCriticalSection了吗,出错位置指向了CComSafeDeleteCriticalSection的Lock函数,出错原因好像是说在运行Lock前没有运行Init初始化函数。

HRESULT Lock()
{
// CComSafeDeleteCriticalSection::Init or CComAutoDeleteCriticalSection::Init
// not called or failed.
// m_critsec member of CComObjectRootEx is now of type
// CComAutoDeleteCriticalSection. It has to be initialized
// by calling CComObjectRootEx::_AtlInitialConstruct
ATLASSUME(m_bInitialized);
return CComCriticalSection::Lock();
}