Jelajahi Sumber

* move freeing of the event log to a separate, virtual method so that this can be changed depending on the needs of TCustomWebApplication.CreateEventLog (e.g. when using a TCustomWebApplication descendant together with a TDaemonApplication)

Sven Barth 3 tahun lalu
induk
melakukan
7c6f3810e3
1 mengubah file dengan 7 tambahan dan 2 penghapusan
  1. 7 2
      packages/fcl-web/src/base/custweb.pp

+ 7 - 2
packages/fcl-web/src/base/custweb.pp

@@ -139,6 +139,7 @@ Type
   protected
     Procedure DoRun; override;
     Function CreateEventLog : TEventLog; virtual;
+    procedure FreeEventLog(AEventLog: TEventLog); virtual;
     function InitializeWebHandler: TWebHandler; virtual; abstract;
     Procedure DoLog(EventType: TEventType; const Msg: String); override;
     procedure SetTitle(const AValue: string); override;
@@ -579,6 +580,11 @@ begin
     end;
 end;
 
+procedure TCustomWebApplication.FreeEventLog(AEventLog: TEventLog);
+begin
+  AEventLog.Free;
+end;
+
 function TCustomWebApplication.GetEventLog: TEventLog;
 
 begin
@@ -731,8 +737,7 @@ end;
 destructor TCustomWebApplication.Destroy;
 begin
   FWebHandler.Free;
-  if assigned(FEventLog) then
-    FEventLog.Free;
+  FreeEventLog(FEventLog);
   Inherited;
 end;