1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

Update to CEF 95.7.12

Fix for Windows shutdown issue thanks to petko
This commit is contained in:
salvadordf
2021-10-26 10:29:58 +02:00
parent 9b90babbcb
commit f9b7447094
7 changed files with 66 additions and 26 deletions

View File

@@ -245,7 +245,10 @@ type
protected
FResponse : TStringList;
FRequest : TStringList;
FNavigation : TStringList;
FNavigation : TStringList;
FShutdownReason : string;
FHasShutdownReason : boolean;
// Variables to control when can we destroy the form safely
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
FClosing : boolean; // Set to True in the CloseQuery event.
@@ -286,6 +289,7 @@ type
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
procedure WMQueryEndSession(var aMessage: TWMQueryEndSession); message WM_QUERYENDSESSION;
public
procedure ShowStatusText(const aText : string);
@@ -1060,7 +1064,11 @@ begin
FRequest := TStringList.Create;
FNavigation := TStringList.Create;
FDevToolsMsgID := 0;
FDevToolsMsgID := 0;
// Windows may show this text message while shutting down the operating system
FShutdownReason := 'MiniBrowser closing...';
FHasShutdownReason := ShutdownBlockReasonCreate(Application.Handle, @FShutdownReason[1]);
// The MultiBrowserMode store all the browser references in TChromium.
// The first browser reference is the browser in the main form.
@@ -1074,7 +1082,10 @@ begin
end;
procedure TMiniBrowserFrm.FormDestroy(Sender: TObject);
begin
begin
if FHasShutdownReason then
ShutdownBlockReasonDestroy(Application.Handle);
FResponse.Free;
FRequest.Free;
FNavigation.Free;
@@ -1608,6 +1619,18 @@ begin
if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False;
end;
procedure TMiniBrowserFrm.WMQueryEndSession(var aMessage: TWMQueryEndSession);
begin
// We return False (0) to close the browser correctly.
// Windows may show the FShutdownReason message that we created in
// TForm.OnCreate if the shutdown takes too much time.
// CEF4Delphi sets the subprocesses to receive the WM_QUERYENDSESSION
// message after the main browser process with a
// SetProcessShutdownParameters call
aMessage.Result := 0;
PostMessage(Handle, WM_CLOSE, 0, 0);
end;
procedure TMiniBrowserFrm.Deczoom1Click(Sender: TObject);
begin
Chromium1.DecZoomStep;