Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Debugging problem in Visual C++ .net

Status
Not open for further replies.

darioars

Technical User
Oct 30, 2002
21
0
0
DE
Hi guys!

I have a C++ application which I have built in a Visual C++.net environment. After this process of building, no errors are found, so I can start debugging, but after creating a second thread displaying its own window (I don't know if this is relevant), another window containing an error message appears on the screen. This error says "Debug Assertion Failed!" and the file where the problem is found appears. It's also said "Expression: 0".

Can any of you help me? I'd appreciate it a lot!

Darío.
 
Do you have any idea where the bug is?

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
Yes, I know! After launching this secondary thread, when its execution is over, it is, when the corresponding function reaches its last line and the flow control is given back to the main thread of the application, then the problems appear. The file that seems to produce it is "atlwin.h" and it's opened and the lines that appear are:

#ifdef _DEBUG
if(m_hWnd != NULL) // should be cleared in WindowProc
{
ATLTRACE(atlTraceWindowing, 0, _T("ERROR - Object deleted before window was destroyed\n"));
ATLASSERT(FALSE);
}
#endif //_DEBUG

Is it a hint?

Darío.
 
ASSERT() is used in debug code to check for things which are supposed to be true at various points in the code. When an ASSERT is triggered, something has gone wrong in the logic of the code and it needs to be fixed.

Easy example
Code:
double square_root ( double x ) {
    ASSERT(x>=0);
    return sqrt(x);
}
If this ASSERT ever triggered, you would work your way back through the code to find out why you had a negative value of x, and why you were trying to find a square root of it.

The clue is in the message
"Object deleted before window was destroyed"
Seems to me like you need to destroy some window somewhere before trying to destroy the object which encapsulates the window.

--
 
Thanks a lot Salem!

You're right! I forgot to destroy a window before the execution of the programme came to an end ...

Darío.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top