Click here to Skip to main content
16,010,334 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: dialog box constantly reappearing Pin
elephantstar1-Jul-04 7:23
elephantstar1-Jul-04 7:23 
GeneralRe: dialog box constantly reappearing Pin
rw1041-Jul-04 2:08
rw1041-Jul-04 2:08 
GeneralRe: dialog box constantly reappearing Pin
elephantstar6-Jul-04 11:37
elephantstar6-Jul-04 11:37 
Questionhow to minimize all windows Pin
5iveboy30-Jun-04 13:13
5iveboy30-Jun-04 13:13 
AnswerRe: how to minimize all windows Pin
palbano30-Jun-04 13:27
palbano30-Jun-04 13:27 
GeneralShellExecute question Pin
5iveboy30-Jun-04 13:10
5iveboy30-Jun-04 13:10 
GeneralRe: ShellExecute question Pin
palbano30-Jun-04 13:16
palbano30-Jun-04 13:16 
General!UPDATED! Debug works but release crashes (this one's tricky) Pin
boxmonkey30-Jun-04 10:59
boxmonkey30-Jun-04 10:59 
Original message:

I have read the codeproject article about Finding crash information using the MAP file, which was helpful, but I'm stuck.

I have a very complex program full of dialog boxes that are derived from a class that is derived from CDialog. Inside these dialogs are a bunch of edit boxes of type CTableFieldEdit, which is derived from CEdit.

The program works beautifully in debug mode, but crashes in release mode some time between when I create the dialog item and when I call DoModal()

From what I've been able to determine, the crash happens in MFC42.dll, but it crashes in two different places, depending on which dialog I'm calling. Some of the dialogs crash at the address for GetStyle and some of them crash after the address for ScrollWindowEx, according to the map file.

I have already turned off all optimizations.

I'm stuck. What might I be doing wrong?

I can post some or all of the code if it will help.
I can even post the entire project if you like, but you won't be able to run the program as it connects to a database.

Thanks!

Update:
The problem seems to be related to how I handle message maps in my derived dialog classes, but I don't know how to fix it or why it works correctly in Debug mode, but not Release mode.

Here's what's happening:

My Dialog boxes are derived from CFormHelperDlg, which is a class I made to reduce code redundancy.
CFormHelperDlg is derived from CDialog.

There are certain messages I want to handle in CFormHelperDlg rather than in the class for each given dialog (since all the code is redundant), so I set up my message maps as such:

In CJailDialog (which is derived from CFormHelperDlg):

BEGIN_MESSAGE_MAP(CJailDialog, CFormHelperDlg)
//{{AFX_MSG_MAP(CJailDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

In CFormHelperDlg (which is derived from CDialog):

BEGIN_MESSAGE_MAP(CFormHelperDlg, CDialog)
//{{AFX_MSG_MAP(CFormHelperDlg)
ON_BN_CLICKED(IDC_BUTTON_JAN, OnButtonJan)
ON_BN_CLICKED(IDC_BUTTON_FEB, OnButtonFeb)
ON_BN_CLICKED(IDC_BUTTON_MAR, OnButtonMar)
ON_BN_CLICKED(IDC_BUTTON_APR, OnButtonApr)
ON_BN_CLICKED(IDC_BUTTON_MAY, OnButtonMay)
ON_BN_CLICKED(IDC_BUTTON_JUN, OnButtonJun)
ON_BN_CLICKED(IDC_BUTTON_JUL, OnButtonJul)
ON_BN_CLICKED(IDC_BUTTON_AUG, OnButtonAug)
ON_BN_CLICKED(IDC_BUTTON_SEP, OnButtonSep)
ON_BN_CLICKED(IDC_BUTTON_OCT, OnButtonOct)
ON_BN_CLICKED(IDC_BUTTON_NOV, OnButtonNov)
ON_BN_CLICKED(IDC_BUTTON_DEC, OnButtonDec)
ON_BN_CLICKED(IDC_MANAGER_SIGNOFF, OnManagerSignoff)
ON_MESSAGE(WM_INITDIALOG, OnInitDialog)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()


...each of those buttons exists on all the dialog boxes derived from CFormHelperDlg, so I'd rather just keep the message map there.
I've been using this all along because it worked fine in Debug mode.

I discovered the error was the message map by changing CJailDialog's message map to:

BEGIN_MESSAGE_MAP(CJailDialog, CDialog)
//{{AFX_MSG_MAP(CJailDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

And suddenly there was no crashing.
Of course, it also didn't respond to the buttons anymore Cry | :((

What do I need to do in order to make this work in release mode the way it works in debug mode?
GeneralRe: Debug works but release crashes (this one's tricky) Pin
Roger Allen30-Jun-04 11:41
Roger Allen30-Jun-04 11:41 
GeneralRe: Debug works but release crashes (this one's tricky) Pin
boxmonkey30-Jun-04 12:10
boxmonkey30-Jun-04 12:10 
GeneralRe: Debug works but release crashes (this one's tricky) Pin
PJ Arends30-Jun-04 11:55
professionalPJ Arends30-Jun-04 11:55 
GeneralRe: Debug works but release crashes (this one's tricky) Pin
boxmonkey30-Jun-04 12:10
boxmonkey30-Jun-04 12:10 
GeneralRe: !UPDATED! Debug works but release crashes (this one's tricky) Pin
Yawar Maajed30-Jun-04 13:16
Yawar Maajed30-Jun-04 13:16 
GeneralRe: !UPDATED! Debug works but release crashes (this one's tricky) Pin
Yawar Maajed30-Jun-04 13:22
Yawar Maajed30-Jun-04 13:22 
GeneralRe: !UPDATED! Debug works but release crashes (this one's tricky) Pin
boxmonkey30-Jun-04 13:38
boxmonkey30-Jun-04 13:38 
GeneralRe: !UPDATED! Debug works but release crashes (this one's tricky) Pin
Yawar Maajed30-Jun-04 13:40
Yawar Maajed30-Jun-04 13:40 
QuestionRe: !UPDATED! Debug works but release crashes (this one's tricky) Pin
dahill20-Mar-06 13:05
dahill20-Mar-06 13:05 
GeneralDisable start button Pin
Larsson30-Jun-04 10:52
Larsson30-Jun-04 10:52 
GeneralRe: Disable start button Pin
P-Rex30-Jun-04 20:32
P-Rex30-Jun-04 20:32 
GeneralRe: Disable start button Pin
Larsson1-Jul-04 0:36
Larsson1-Jul-04 0:36 
Generalicon question Pin
Spiritofamerica30-Jun-04 10:49
Spiritofamerica30-Jun-04 10:49 
GeneralRe: icon question Pin
David Crow30-Jun-04 10:52
David Crow30-Jun-04 10:52 
GeneralNewbee: OLE Drag&Drop CListCtrl Problem Pin
otrcomm30-Jun-04 10:35
otrcomm30-Jun-04 10:35 
Generalphone number Pin
Nemok30-Jun-04 10:20
Nemok30-Jun-04 10:20 
GeneralRe: phone number Pin
David Crow30-Jun-04 10:50
David Crow30-Jun-04 10:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.