Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2004

Tip: Looking for answers? Try searching our database.

SDI project - Problem with pointer in Release Mode.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jerry - 24 May 2004 13:56 GMT
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
David Lowndes - 24 May 2004 17:48 GMT
>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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.