Hello,
I'm trying to turn off application exception capturing (so I can send exception traces via HTTP in bug reports):
1) In (the first loaded unit of) a console app, I did override ExceptProc (see code at bottom) - my own handler is called (as expected) on a EDivByZero exception.
2) In my Lazarus LCL app (SVN 23483M, LCL/Win32/i386, fpc 2.4.0), I did the same like in the console app - additionally, I did set Application.CaptureExceptions to 'false':
Application.Initialize;
Application.CreateForm(TForm1, Form1);
application.CaptureExceptions:=false;
Application.Run;Now, when a EDivByZero is raised, my own handler is *not* called - instead the default TApplication.HandleException is called - To my surprise...
a) When raised before Application.Run, my own handler is called (as it should).
b) When I debug Application.Run, it correctly uses the case without exception handling(!) - that is, it correctly detects the CaptureExceptions change.
c) When I read ExceptProc right before the exception, it correctly has the value of my own handler(!)
Though, my own handler is never called within Application.Run - and I have no idea why...
Any help or ideas are welcome!
Thanks,
Alexander
---------------Console output------------------------
install
application.CaptureExceptions=0
TApplication.HandleException Division by zero
Stack trace:
$00420413 CRASHME, line 39 of unit1.pas
$0042047A TFORM1__BUTTONCRASHMECLICK, line 46 of unit1.pas $004C6234 TCONTROL__CLICK, line 2294 of ./include/control.inc $004FA26F TBUTTONCONTROL__CLICK, line 72 of ./include/buttoncontrol.inc $004FA745 TCUSTOMBUTTON__CLICK, line 164 of ./include/buttons.inc $004FACA1 TBUTTON__CLICK, line 331 of ./include/buttons.inc $004FA10A TBUTTONCONTROL__WMDEFAULTCLICKED, line 26 of ./include/buttoncontrol.inc
$0040A84A
$004BCE72 TWINCONTROL__WNDPROC, line 5102 of ./include/wincontrol.inc $0050FCC7 DELIVERMESSAGE, line 111 of lclmessageglue.pas $004DB6B0 WINDOWPROC, line 2621 of win32callback.inc $77D18709
$77D187EB
$77D1B743
$77D1B7AB
$773C6FF6
$773C70D8
-----------My exception handler---------------------
procedure MyExceptionHandler(
Obj : TObject; // ExceptObject
Addr: Pointer; // ExceptAddr
FrameCount: Longint; // ExceptFrameCount
Frames: PPointer // ExceptFrames
);
begin
writeln('MyExceptionHandler');
ShowException(obj, addr);
end;
initialization
writeln('install');
exceptproc := @MyExceptionHandler;