Changeset 165 for ExceptionLogger


Ignore:
Timestamp:
Feb 8, 2011, 11:07:15 AM (14 years ago)
Author:
george
Message:
  • Modified: ExceptionHandler entry method merged from non-thread and thread method.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ExceptionLogger/UExceptionLogger.pas

    r149 r165  
    2727    destructor Destroy; override;
    2828    procedure ExceptionHandler(Sender: TObject; E: Exception);
    29     procedure ThreadExceptionHandler(Thread: TThread; E: Exception);
    3029    procedure CreateTextReport(Output: TStringList);
    3130    procedure LogToFile(Report: TStringList);
     
    137136begin
    138137  ExceptionForm.LoadStackTraceToListView(StackTrace);
    139   ExceptionForm.ShowModal;
     138  if not ExceptionForm.Visible then ExceptionForm.ShowModal;
    140139end;
    141140
     
    145144  StackTrace.GetExceptionBackTrace;
    146145  LastException := E;
    147   MakeReport;
    148 end;
    149 
    150 procedure TExceptionLogger.ThreadExceptionHandler(Thread: TThread; E: Exception
    151   );
    152 begin
    153   BackTraceStrFunc := @StabBackTraceStr;
    154   StackTrace.GetExceptionBackTrace;
    155   LastException := E;
    156   TThread.Synchronize(Thread, MakeReport);
     146  if Sender is TThread then TThread.Synchronize(TThread(Sender), MakeReport)
     147    else MakeReport;
    157148end;
    158149
Note: See TracChangeset for help on using the changeset viewer.