1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-08-04 21:32:54 +02:00

Fixed circular reference in TCustomCefUrlrequestClient

Added the TCefApplication.DisableBackgroundNetworking and TCefApplication.MetricsRecordingOnly properties
This commit is contained in:
Salvador Díaz Fau
2018-12-06 11:49:08 +01:00
parent f7ffd5c4c9
commit 0688b10e1d
4 changed files with 66 additions and 16 deletions

View File

@@ -85,10 +85,12 @@ type
// Custom
procedure doOnCreateURLRequest;
procedure DestroyRequestClient;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
procedure AddURLRequest;
@@ -133,13 +135,6 @@ begin
FOnCreateURLRequest := nil;
end;
destructor TCEFUrlRequestClientComponent.Destroy;
begin
FClient := nil;
inherited Destroy;
end;
procedure TCEFUrlRequestClientComponent.AfterConstruction;
begin
inherited AfterConstruction;
@@ -148,6 +143,27 @@ begin
FClient := TCustomCefUrlrequestClient.Create(self);
end;
procedure TCEFUrlRequestClientComponent.BeforeDestruction;
begin
DestroyRequestClient;
inherited BeforeDestruction;
end;
procedure TCEFUrlRequestClientComponent.DestroyRequestClient;
begin
try
if (FClient <> nil) then
begin
FClient.RemoveReferences;
FClient := nil;
end;
except
on e : exception do
if CustomExceptionHandler('TCEFUrlRequestClientComponent.DestroyRequestClient', e) then raise;
end;
end;
procedure TCEFUrlRequestClientComponent.doOnRequestComplete(const request: ICefUrlRequest);
begin
if assigned(FOnRequestComplete) then FOnRequestComplete(self, request);