Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC7.1 Windows
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 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?
Posted 4-Dec-10 6:22am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Most likely the crash is in a deeper function. The debugger show it in your DispatchMessage 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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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?
  Permalink  
Comments
Uwe Keim at 5-Dec-10 13:57pm
   
You could somehow get symbols for the system DLLs from Microsoft (I do not remember how), so your stack trace looks more readable.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 295
1 OriginalGriff 273
2 Aajmot Sk 234
3 Marcin Kozub 205
4 Richard MacCutchan 200
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,127
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 9 Sep 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100