473,491 Members | 3,350 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

SDI project - Problem with pointer in Release Mode.

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
Nov 17 '05 #1
2 1683
>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 View
m_pTabViewWnd = (CTabVw *)GetGrandParent();

//this is the function:
CWnd* CSmsPropPage::GetGrandParent()
{
CWnd *parent= GetParent(); // tab control is the parent
return parent->GetParent(); // tab view is the grandparent
}

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
Nov 17 '05 #2
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...refnoinline.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.
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2687
by: Norm Wong | last post by:
If anyone is interested in using db2uext2 with Cygwin gcc compiler on Windows, I've modified the IBM provided sample with the attached file. There are two main modifications. The mkdir command...
1
4218
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here....
11
1970
by: The_Kingpin | last post by:
Hi all, I'm new to C programming and looking for some help. I have a homework project to do and could use every tips, advises, code sample and references I can get. Here's what I need to do....
1
2632
by: bob | last post by:
Hello, I have a SetUp project in my solution. When I add the primary output of certain projects to it they add their project dependencies twice - the debug and the release. Anyone known what...
6
4646
by: FS Liu | last post by:
Hi, In my current ATL server project, I have to parse the input in the client application's request to find out the different combination of parameters, instead of using SOAP. For this reason,...
0
3907
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
2
1797
by: job | last post by:
I put my StrongNameKey.snk in my root foler. in my assemblyinfo.vb I have: <Assembly: AssemblyKeyFileAttribute("StrongNameKey.snk")> I get the error "Error creating assembly manifest: Error...
5
3847
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I have a solution with 50 projects. They are all compiled in DEBUG mode and the output path has been modified to a custom directory I now want to build RELEASE mode and the Output Path...
6
2846
by: priyajohal | last post by:
#include<fstream.h> #include<process.h> #include<stdlib.h> #include<conio.h> #include<string.h> #include<dos.h> #include<ctype.h> #include<stdio.h> void setup() void help();
0
7118
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6862
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.