我非常努力地从遗留代码访问冲突中捕捉到:
First-chance exception at 0x57e77e1c in YouTubeLocal.exe: 0xC0000005: Access violation reading location 0x0000000c.
我的堆栈如下所示:
Qt5Guid.dll!57e77e1c()
[Frames below may be incorrect and/or missing, no symbols loaded for Qt5Guid.dll]
Qt5Guid.dll!57e75604()
Qt5Guid.dll!57ed520b()
Qt5Guid.dll!57dcf18b()
> msvcr100d.dll!_unlock(int locknum=0x00000004) Line 375 C
msvcr100d.dll!_heap_alloc_dbg_impl(unsigned int nSize=0x00000040, int nBlockUse=0x00000001, const char * szFileName=0x00000000, int nLine=0x00000000, int * errno_tmp=0x0015cb70) Line 507 + 0x7 bytes C++
msvcr100d.dll!_heap_alloc_dbg_impl(unsigned int nSize=0x00000040, int nBlockUse=0x00000001, const char * szFileName=0x00000000, int nLine=0x00000000, int * errno_tmp=0x0015cb70) Line 504 + 0xc bytes C++
msvcr100d.dll!_nh_malloc_dbg_impl(unsigned int nSize=0x00000040, int nhFlag=0x00000000, int nBlockUse=0x00000001, const char * szFileName=0x00000000, int nLine=0x00000000, int * errno_tmp=0x0015cb70) Line 239 + 0x19 bytes C++
msvcr100d.dll!_nh_malloc_dbg(unsigned int nSize=0x00000002, int nhFlag=0x0015cbdc, int nBlockUse=0x0015cbc8, const char * szFileName=0x0015cbb0, int nLine=0x0015cbc8) Line 302 + 0x1d bytes C++
Qt5Cored.dll!533b0628()
Qt5Cored.dll!53388046()
Qt5Cored.dll!5335f56b()
Qt5Cored.dll!535e74c4()
Qt5Cored.dll!536f7198()
Qt5Widgetsd.dll!53aa4aea()
kernel32.dll!778bc3d4()
msvcr100d.dll!_unlock(int locknum=0x00000004) Line 375 C
msvcr100d.dll!_free_dbg(void * pUserData=0x53a4b300, int nBlockUse=0x019757a0) Line 1270 + 0x7 bytes C++
msvcr100d.dll!_free_dbg(void * pUserData=0x53a4b300, int nBlockUse=0x019757a0) Line 1267 + 0xc bytes C++
01b4bd40()
kernel32.dll!778bc3d4()
msvcr100d.dll!_free_base(void * pBlock=0x0015d060) Line 50 + 0x13 bytes C
018a4a84()
kernel32.dll!778bc3d4()
msvcr100d.dll!_free_base(void * pBlock=0x57c49736) Line 50 + 0x13 bytes C
0015d140()
feeefeee()
调试器在此文件 (mlock.c) 中停止
/***
* _unlock - Release multi-thread lock
*
*Purpose:
* Note that it is legal for a thread to aquire _EXIT_LOCK1
* multiple times.
*
*Entry:
* locknum = number of the lock to release
*
*Exit:
*
*Exceptions:
*
*******************************************************************************/
void __cdecl _unlock (
int locknum
)
{
/*
* leave the critical section.
*/
LeaveCriticalSection( _locktable[locknum].lock );
}
我找不到发生访问冲突的行。如何捕获导致异常的行?
更新:
这是我的解决方案:
Microsoft Application Verifier