Re: frame creation bug in release mode

Tech-Archive recommends: Fix windows errors by optimizing your registry




> I have a MDI MFC app which works well in debug mode.
> But in release mode, one of my dialog crashes the app the *second time*
> it is openned ! (everything is fine the first time the dialog is
> openned)
> Two errors are displayed :
> - "An exception (0xC0000090) occured during DllEntryPoint or DllMain
> module : D:\path_to_a_dll\a_dll.dll"
> - An invalid floating point operation (0xC0000090) ... In fact this is
> the same error ...
> But I don't use the specified Dll (which is one of my project's dll) in
> this dialog ; and I also don't use any floating point operation near
> the error.

It still makes sense to get the release build run under debugger (see below) and
check the call stack at the moment when the exception is thrown - then you will
know exactly who is calling that DLL, and which thread is used. It also makes
sense to configure the debugger to stop on first chance exceptions for this kind
of exception (in Debug | Exceptions dialog).

Also, I would suspect reuse-after-free problem (the dialog could rely
on a resource (e.g. a C++ object) that gets released/deleted when the dialog
is closed for the first time).

> The OnCreate function is called, but as soon as the function returns
> after "Create", the app crashes. I tried to put an AfxMessageBox just
> after the "Create" call, and the box is displayed, but the program
> crashes at the same time. That's why I think the error comes from
> another thread (the message box blocks the current thread, so if an
> error appears before I click the OK button, it must be another
> thread...)

AfxMessageBox dispatches messages internally, so it could be another
message on the same thread. Call stack should tell you.

> I also tried to add debug information in order to use breakpoints in
> release mode, but then it works like in debug mode : the error
> disappears ! I can only use my log file or message boxes to debug :(
>

Try to start the application without debugger, and then attach the debugger to it.

Btw, such behavior also can be a sign of heap corruption (and you can use PageHeap
to detect the places where it happens).
http://www.debuginfo.com/tips/userbpntdll.html

Regards,
Oleg
[VC++ MVP http://www.debuginfo.com/]







.


Quantcast