diff --git a/demos/Delphi_FMX/FMXExternalPumpBrowser2/FMXExternalPumpBrowser2_sp.dpr b/demos/Delphi_FMX/FMXExternalPumpBrowser2/FMXExternalPumpBrowser2_sp.dpr
index 95538f5f..b5c85fd2 100644
--- a/demos/Delphi_FMX/FMXExternalPumpBrowser2/FMXExternalPumpBrowser2_sp.dpr
+++ b/demos/Delphi_FMX/FMXExternalPumpBrowser2/FMXExternalPumpBrowser2_sp.dpr
@@ -50,6 +50,12 @@ begin
GlobalCEFApp.EnableHighDPISupport := True;
GlobalCEFApp.ExternalMessagePump := True;
GlobalCEFApp.MultiThreadedMessageLoop := False;
+
+ // This is a workaround to fix a Chromium initialization crash.
+ // The current FMX solution to initialize CEF with a loader unit
+ // creates a race condition with the media key controller in Chromium.
+ GlobalCEFApp.DisableFeatures := 'HardwareMediaKeyHandling';
+
GlobalCEFApp.StartSubProcess;
DestroyGlobalCEFApp;
end.
diff --git a/demos/Delphi_FMX/FMXExternalPumpBrowser2/uCEFLoader.pas b/demos/Delphi_FMX/FMXExternalPumpBrowser2/uCEFLoader.pas
index 1a43fad2..69b7b629 100644
--- a/demos/Delphi_FMX/FMXExternalPumpBrowser2/uCEFLoader.pas
+++ b/demos/Delphi_FMX/FMXExternalPumpBrowser2/uCEFLoader.pas
@@ -47,25 +47,16 @@ uses
// project.
// Read the answer to this question for more more information :
// https://stackoverflow.com/questions/52103407/changing-the-initialization-order-of-the-unit-in-delphi
- System.SyncObjs,
uCEFApplication, uCEFConstants, uCEFWorkScheduler;
implementation
-var
- CEFContextInitEvent : TEvent;
-
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
begin
if (GlobalCEFWorkScheduler <> nil) then
GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
end;
-procedure GlobalCEFApp_OnContextInitialized;
-begin
- CEFContextInitEvent.SetEvent;
-end;
-
procedure InitializeGlobalCEFApp;
begin
// TCEFWorkScheduler will call cef_do_message_loop_work when
@@ -83,28 +74,23 @@ begin
GlobalCEFApp.MultiThreadedMessageLoop := False;
GlobalCEFApp.DisableZygote := True;
GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork;
- GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
GlobalCEFApp.BrowserSubprocessPath := 'FMXExternalPumpBrowser2_sp';
- GlobalCEFApp.LogFile := 'debug.log';
- GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
- if GlobalCEFApp.StartMainProcess then
- begin
- // Wait until the context is initialized
- CEFContextInitEvent.WaitFor(10000);
- // Now we can create the GlobalCEFWorkScheduler background thread
- GlobalCEFWorkScheduler.CreateThread;
- end;
+ // This is a workaround to fix a Chromium initialization crash.
+ // The current FMX solution to initialize CEF with a loader unit
+ // creates a race condition with the media key controller in Chromium.
+ GlobalCEFApp.DisableFeatures := 'HardwareMediaKeyHandling';
+
+ GlobalCEFApp.StartMainProcess;
+ GlobalCEFWorkScheduler.CreateThread;
end;
initialization
- CEFContextInitEvent := TEvent.Create;
InitializeGlobalCEFApp;
finalization
if (GlobalCEFWorkScheduler <> nil) then GlobalCEFWorkScheduler.StopScheduler;
DestroyGlobalCEFApp;
DestroyGlobalCEFWorkScheduler;
- CEFContextInitEvent.Free;
end.
diff --git a/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lps b/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lps
index 1e0da1a1..4853c92c 100644
--- a/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lps
+++ b/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lps
@@ -7,10 +7,11 @@
-
+
+
@@ -20,15 +21,15 @@
-
-
+
+
-
-
-
-
-
+
+
+
+
+
@@ -830,123 +831,127 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
+
+
+
+
diff --git a/demos/Lazarus_Linux/OSRExternalPumpBrowser/uosrexternalpumpbrowser.pas b/demos/Lazarus_Linux/OSRExternalPumpBrowser/uosrexternalpumpbrowser.pas
index 22c4e7ed..ba31e732 100644
--- a/demos/Lazarus_Linux/OSRExternalPumpBrowser/uosrexternalpumpbrowser.pas
+++ b/demos/Lazarus_Linux/OSRExternalPumpBrowser/uosrexternalpumpbrowser.pas
@@ -193,21 +193,12 @@ uses
Math, gtk2, glib2, gdk2, gtk2proc, gtk2int,
uCEFMiscFunctions, uCEFApplication, uCEFBitmapBitBuffer, uCEFWorkScheduler;
-var
- CEFContextInitEvent : TSimpleEvent = nil;
-
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
begin
if (GlobalCEFWorkScheduler <> nil) then
- GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
+ GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
end;
-procedure GlobalCEFApp_OnContextInitialized;
-begin
- if (CEFContextInitEvent <> nil) then
- CEFContextInitEvent.SetEvent;
-end;
-
procedure CreateGlobalCEFApp;
begin
// TCEFWorkScheduler will call cef_do_message_loop_work when
@@ -217,7 +208,6 @@ begin
// We use CreateDelayed in order to have a single thread in the process while
// CEF is initialized.
GlobalCEFWorkScheduler := TCEFWorkScheduler.CreateDelayed;
- CEFContextInitEvent := TSimpleEvent.Create;
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.WindowlessRenderingEnabled := True;
@@ -232,16 +222,8 @@ begin
// https://bitbucket.org/chromiumembedded/cef/issues/2964/gpu-is-not-usable-error-during-cef
GlobalCEFApp.DisableZygote := True; // this property adds the "--no-zygote" command line switch
- GlobalCEFApp.LogFile := 'debug.log';
- GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
-
- if GlobalCEFApp.StartMainProcess then
- begin
- // Wait until the context is initialized
- CEFContextInitEvent.WaitFor(5000);
- // Now we can create the GlobalCEFWorkScheduler background thread
- GlobalCEFWorkScheduler.CreateThread;
- end;
+ GlobalCEFApp.StartMainProcess;
+ GlobalCEFWorkScheduler.CreateThread;
end;
function GTKKeyPress(Widget: PGtkWidget; Event: PGdkEventKey; Data: gPointer) : GBoolean; cdecl;
@@ -694,7 +676,6 @@ procedure TForm1.FormDestroy(Sender: TObject);
begin
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
- if (CEFContextInitEvent <> nil) then FreeAndNil(CEFContextInitEvent);
end;
procedure TForm1.FormHide(Sender: TObject);
diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json
index b80d7487..393b206d 100644
--- a/update_CEF4Delphi.json
+++ b/update_CEF4Delphi.json
@@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
- "InternalVersion" : 240,
+ "InternalVersion" : 241,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "88.1.6.0"
}