DispatchMessage崩溃,为什么? [英] Crash in DispatchMessage, why?
本文介绍了DispatchMessage崩溃,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的:
我有一个工作线程,其中有一个窗口.线程proc像这样:
Hi, dear all:
I have a worker thread which have a window in it. The thread proc like:
unsigned __stdcall ThreadFunc( void *param )
{
MyWindow myWin;
MSG msg;
BOOL bRet;
while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
{
if (bRet == -1)
{
// handle the error and possibly exit
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
MyWindow派生自CWindowImpl.现在我的问题是,该程序在DispachMessage中随机崩溃,如崩溃报告中的minidump中所示.
MyWindow is derived from CWindowImpl. Now my problem is that this program crashed in DispachMessage randomly as shown in minidump in crash reports.
What could be the problem?
推荐答案
崩溃很可能是在更深层的功能中造成的.调试器会在您的DispatchMessage
函数中显示它,因为它是最接近的具有源代码的代码.
C ++调试器是否能够显示所有堆栈跟踪条目,而不仅仅是显示源代码的条目?
这可能有助于发现真正的问题.
干杯
Uwe
Most likely the crash is in a deeper function. The debugger show it in yourDispatchMessage
function, because it is the nearest one with source code available.
Is the C++ debugger capable of showing all stack trace entries, not just the ones that you have source code for?
This could help in detecting the real issue.
Cheers
Uwe
是的,当我使用windbg打开minidump时,我得到了所有堆栈跟踪,如下所示:
00 1a14f398 76cd86ef 0xfdf920e
01 1a14f3c4 76cd8876 user32 + 0x186ef
02 1a14f43c 76cd70f4 user32 + 0x18876
03 1a14f498 76cccea0 user32 + 0x170f4
04 1a14fcc8 771d647e user32 + 0xcea0
05 1a14fd34 21725f86 ntdll + 0x4647e
06 1a14ff38 1a14ff20 RJCK!ThreadFunc + 0xb6
或类似:
00 1a14f398 76cd86ef 0xfdf920e
01 1a14f3c4 76cd8876 user32!InternalCallWinProc + 0x23
02 1a14f43c 76cd70f4 user32!UserCallWinProcCheckWow + 0x14b
03 1a14f498 76cccea0 user32!DispatchClientMessage + 0xda
04 1a14fcc8 771d647e user32!__ fnOUTSTRING + 0x63
05 1a14fcd0 00000000 ntdll!KiUserCallbackDispatcher + 0x2e
味精很常见,例如WM_TIMER等.它是有线的.我认为原因是在开始处理所有循环中的msg之前,Window类已被破坏.但是,当句柄无效时,GetMessage将返回-1.现在我认为堆栈可能在某个窗口proc中被破坏了,然后当它返回时崩溃.还是我的获胜过程被其他代码破坏了,有可能吗?
Yes, I got the all stack trace when I use windbg open the minidump, like below:
00 1a14f398 76cd86ef 0xfdf920e
01 1a14f3c4 76cd8876 user32+0x186ef
02 1a14f43c 76cd70f4 user32+0x18876
03 1a14f498 76cccea0 user32+0x170f4
04 1a14fcc8 771d647e user32+0xcea0
05 1a14fd34 21725f86 ntdll+0x4647e
06 1a14ff38 1a14ff20 RJCK!ThreadFunc+0xb6
or like :
00 1a14f398 76cd86ef 0xfdf920e
01 1a14f3c4 76cd8876 user32!InternalCallWinProc+0x23
02 1a14f43c 76cd70f4 user32!UserCallWinProcCheckWow+0x14b
03 1a14f498 76cccea0 user32!DispatchClientMessage+0xda
04 1a14fcc8 771d647e user32!__fnOUTSTRING+0x63
05 1a14fcd0 00000000 ntdll!KiUserCallbackDispatcher+0x2e
And the msg is common, like WM_TIMER and so on. It''s wired. I think the reason is Window class destroyed before all msg in loop has handled at first. But GetMessage will return -1 when the handle is invalid. Now I think the stack maybe destoyed in some window proc, then when it crash when it return. Or maybe my win proc is destroy by other code, is it possible?
这篇关于DispatchMessage崩溃,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文