The easiest fix was this:
Code: Select all
procedure TChromium.doOnAfterCreated(const browser: ICefBrowser);
begin
// if MultithreadApp and (FBrowser = nil) then
if {MultithreadApp and} (FBrowser = nil) then // HV
begin
FBrowser := browser;
if (FBrowser <> nil) then FBrowserId := FBrowser.Identifier;
end;
Internal_UpdatePreferences;
FInitialized := (FBrowser <> nil) and (FBrowserId <> 0);
if Assigned(FOnAfterCreated) then FOnAfterCreated(Self, browser);
end;
Code: Select all
constructor TVCLClientHandler.Create(const crm: IChromiumEvents; renderer : Boolean);
begin
inherited Create(crm, renderer);
if not(MultithreadApp) and not(ExternalMessagePump) then
begin
if (CefInstances = 0) then CefTimer := SetTimer(0, 0, USER_TIMER_MINIMUM, @TimerProc);
end;
InterlockedIncrement(CefInstances); // HV: Bug-fix
end;
destructor TVCLClientHandler.Destroy;
begin
try
try
InterlockedDecrement(CefInstances); // HV: Bug-fix
if not(MultithreadApp) and not(ExternalMessagePump) then
begin
if (CefInstances = 0) and (CefTimer <> 0) then
begin
KillTimer(0, CefTimer);
CefTimer := 0;
end;
end;