Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
4.00/5 (3 votes)
Should an ASSERT_VALID stop in the debugger ?

I'm trying to trace a crash when our application closes.

It crashes somewhere in CFrameWnd::OnClose (in a ::DestroyWindow).

In the message log there is a ASSERT_VALID that is logged; but the debugger does NOT stop on the assert:

C++
ASSERT_VALID fails with NULL pointer.


Not much help that gives me; no code reference (file or line number or allocation number)

I tried enabling all the exceptions, but no change.

Am I missing something ?

Thanks.
Posted
Updated 1-Aug-12 5:24am
v2
Comments
nv3 1-Aug-12 11:20am    
Did you mean "... but the debugger didn't stop on the assert"?
Maximilien 1-Aug-12 11:24am    
oh !!!! yes! ( I will edit the original posts!!) thanks for that.
Maximilien 2-Aug-12 7:16am    
@armagedescu.

I does not break in the debugger, so no call stack.
The report in the meesage area does not show context (line/file/function/method), so I cannot easily find out why it crashes,
anyway, the question was more about the ASSERT_VALID not breaking than debugging.
Thanks.

This type of crash typically occurs when a frame window or view is being deleted via two separate code paths. For one, these windows normally have a

delete this;


in their OnNcDestroy function and de-allocate their object automatically. If it is also accidentally deleted by the user, the mentioned problem occurs.

Perhaps that gives you some help with tracing that one down.
 
Share this answer
 
Quote:
Should an ASSERT_VALID stop in the debugger ?

Short answer, yes.

It won't tell you directly what led to the assertion, but you should be able to look at the call stack and trace back to see what part of your code led to the assertion being triggered.
 
Share this answer
 
Comments
Maximilien 1-Aug-12 10:49am    
Well the ASSERT_VALID does not stop the debugger, that is why I'm asking the question.
Albert Holguin 1-Aug-12 11:38am    
Oh, I see... I misunderstood... it should stop the debugger. I guess now I see how that's a head scratcher.
Albert Holguin 1-Aug-12 11:41am    
Wonder if perhaps you've either overriden the macro or perhaps defined the AssertValid() method in a manner that prevents the usual pop-up.
Maximilien 1-Aug-12 11:44am    
Yes, will have to look into that.

Thanks,

Will report back when I find something useful.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900