MadExcept not detecting crash

delphi package - automated exception handling
jmarder
Posts: 15
Joined: Tue Sep 12, 2017 8:00 am

Re: MadExcept not detecting crash

Post by jmarder »

madshi wrote: 2) The test program from jmarder is interesting. Basically it shows that crashes inside of a custom "AllocateHwnd()" window proc aren't always caught by madExcept. I've analyzed this problem in detail and it seems that the exception is bypassing all of Delphi's own RTL exception handling somehow, so madExcept never gets access to it, and even Windows's "SetUnhandledExceptionFilter()" API doesn't work. It looks like a bug in the RTL to me
Well, the AllocateHwnd() function is just 12 lines of plain Windows API code. Why do you think it is a bug in the RTL? I would volunteer to open an issue at Embaracdro's issue tracker, but I need more details to do so.
madshi wrote: Fortunately, the problem seems to be limited to AllocateHwnd(), and it's easy enough to manually solve by adding a "try .. except madExcept.HandleException() end" block around the AllocateHwnd() window proc.
Unfortunately it is not that easy. AllocateHwnd() is used in several places in the VCL where I can't add this. AllocateHwnd() is also used in many 3rd party libraries where this exception hadnling is also missing and where you can't easily reference MadExcept as not every Delphi Developer has it installed.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: MadExcept not detecting crash

Post by madshi »

Oh cool, I didn't know those PE options yet!
jmarder
Posts: 15
Joined: Tue Sep 12, 2017 8:00 am

Re: MadExcept not detecting crash

Post by jmarder »

Is there any news on the AllocateHwnd() issue?
jmarder
Posts: 15
Joined: Tue Sep 12, 2017 8:00 am

Re: MadExcept not detecting crash

Post by jmarder »

I recently had a very similar case when using the Windows Ribbon Framework for Delphi. When a Command was fired, within this event handler exactly the same happened: App crash instead of MadExcept dialog when an exception occurred. The same applies for Windows Shell change notifications. I think it would be important to address this issue in MadExcept itself.
Post Reply