Closed mrcsms closed 2 years ago
thanks, but your second commit change behavior, what makes you prefer to write it that way (I'm curious and I will maybe learn something)...
sometimes I used it like:
initialization AwUser.GShowExceptionHandler := nil;
and it won't work now.
of course, I will change it to assign an empty method here and it's not a problem at all.
And what exactly does not work? The exception handler is initialized with nil
{code} var GShowExceptionHandler: procedure(ExceptObject: TObject; ExceptAddr: Pointer) = nil; {code}
and in case of an exception the normal handler is called if the global one is nil, otherwise the global is called.
{code} except // SWB on E : Exception do // SWB begin // SWB if Assigned(GShowExceptionHandler) then GShowExceptionHandler(E, ExceptAddr) else ShowException(ExceptObject, ExceptAddr); end; // SWB {code}
In your solution the global could be set to nil and then there is no handler any longer.
Or do mean the ExceptObject instead of E? This was a copy paste not-modify issue. I fixed it.
no, no, it's initialized with the origin SysUtils.ShowException - see InitializeUnit
GShowExceptionHandler := SysUtils.ShowException;
But you can always write
GShowExceptionHandler := nil;
Hi, this is my small modification which allows handling critical exceptions in, for example, multithreaded applications (my case). Accepting PR would make my life easier :). greetings