I have an SDI document that runs fine in Debug Mode but crashes in Release Mode. I have set up my project so I can debug in Release Mode. The project has a tab view
Here is what is happening
OnInitDialog calls this
// parent is Tab Control, grandparent is Tab Vie
m_pTabViewWnd = (CTabVw *)GetGrandParent()
//this is the function
CWnd* CSmsPropPage::GetGrandParent(
CWnd *parent= GetParent(); // tab control is the paren
return parent->GetParent(); // tab view is the grandparen
In the GetGrandParent() function the pointers are not valid in Release Mode. In fact the call to this function takes me into a function called CWnd* PASCAL CWnd::FromHandle(HWND hWnd), then returns. It doesnt step into GetGrandParent() in Release Mode
I dont know why. Can someone help me out?
Jerry
>I have an SDI document that runs fine in Debug Mode but crashes in Release Mode. I have set up my project so I can debug in Release Mode. The project has a tab view.
>
[quoted text clipped - 12 lines]
>
>In the GetGrandParent() function the pointers are not valid in Release Mode. In fact the call to this function takes me into a function called CWnd* PASCAL CWnd::FromHandle(HWND hWnd), then returns. It doesnt step into GetGrandParent() in Release Mode.
Jerry,
It's often difficult to debug a release build - the compiler can
rearrange code, and your program may appear to jump around various
lines of code as you single step it. In this instance the optimizer
could have inlined your function since it's fairly trivial.
It's not possible to offer any reasonable suggestions about what might
be wrong with your release build from the information shown.
Dave
mccoyn - 24 May 2004 18:56 GMT
I believe it is possible to declare a function as noinline. You of course want to switch back after you have found the problem to maintain the performance of your code
http://msdn.microsoft.com/library/en-us/vclang/html/vcrefnoinline.as
The code that you showed looks fine to me. My guesses for this type of problem are: CSmsPropPage is not initialized properly, there is a buffer overwrite somewhere, or an uninitialized variable is being used somewhere. A program like Purify or Insure++ can sometimes find problems of this sort.