Revert exception handling changes: r58071, r58070, r58069 #63946f4466

git-svn-id: trunk@58072 -
This commit is contained in:
ondrej 2018-06-02 06:26:07 +00:00
parent e06e03aa98
commit 4d285fa24b
2 changed files with 17 additions and 31 deletions

View File

@ -174,7 +174,6 @@ type
procedure MainIDEFormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure MainIDEFormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure HandleApplicationUserInput(Sender: TObject; {%H-}Msg: Cardinal);
procedure HandleApplicationException(Sender: TObject; E: Exception);
procedure HandleApplicationIdle(Sender: TObject; var {%H-}Done: Boolean);
procedure HandleApplicationActivate(Sender: TObject);
procedure HandleApplicationDeActivate(Sender: TObject);
@ -997,13 +996,6 @@ begin
end;
end;
procedure HandleOnShowException(Msg: ShortString);
begin
DebugLn('TApplication.HandleException Strange Exception');
DebugLn(Msg);
DumpExceptionBackTrace;
end;
{ TMainIDE }
{-------------------------------------------------------------------------------
@ -1602,8 +1594,6 @@ procedure TMainIDE.StartIDE;
begin
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.StartIDE START');{$ENDIF}
// set Application handlers
SysUtils.OnShowException := @HandleOnShowException;
Application.AddOnExceptionHandler(@HandleApplicationException);
Application.AddOnUserInputHandler(@HandleApplicationUserInput);
Application.AddOnIdleHandler(@HandleApplicationIdle);
Application.AddOnActivateHandler(@HandleApplicationActivate);
@ -11952,16 +11942,6 @@ begin
QuitIDE;
end;
procedure TMainIDE.HandleApplicationException(Sender: TObject; E: Exception);
begin
if not (E is EAbort) then
begin
DebugLn('TApplication.HandleException ',E.Message);
DumpExceptionBackTrace;
Application.ShowException(E);
end;
end;
procedure TMainIDE.HandleScreenChangedForm(Sender: TObject; Form: TCustomForm);
var
aForm: TForm;

View File

@ -1187,16 +1187,6 @@ end;
------------------------------------------------------------------------------}
procedure TApplication.HandleException(Sender: TObject);
procedure ShowInvalidException(ExObject: TObject; ExAddr: Pointer);
// use shortstring. On exception, the heap may be corrupt.
var
Buf: ShortString;
begin
SetLength(Buf,ExceptionErrorMessage(ExObject,ExAddr,@Buf[1],255));
if Assigned(SysUtils.OnShowException) then
SysUtils.OnShowException(Buf);
end;
var
i: LongInt;
Skip: Boolean;
@ -1223,6 +1213,22 @@ begin
Skip := ExceptObject is EAbort;
if not (AppNoExceptionMessages in FFlags) then
begin
// before we do anything, write it down
if ExceptObject is Exception then
begin
if not Skip then
begin
DebugLn('TApplication.HandleException ',Exception(ExceptObject).Message);
DumpExceptionBackTrace;
end;
end else
begin
DebugLn('TApplication.HandleException Strange Exception ');
DumpExceptionBackTrace;
end;
end;
// release capture and hide all forms with stay on top, so that
// a message can be shown
if GetCapture <> 0 then SendMessage(GetCapture, LM_CANCELMODE, 0, 0);
@ -1246,7 +1252,7 @@ begin
end;
end
else
ShowInvalidException(ExceptObject, ExceptAddr);
SysUtils.ShowException(ExceptObject, ExceptAddr);
if not Skip then
RestoreStayOnTop(True);
Exclude(FFlags, AppHandlingException);