Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Errrors on closing app, and odd behavior.

Post Reply
PhillHS
Posts: 6
Joined: Sun Mar 05, 2023 5:27 pm

Errrors on closing app, and odd behavior.

Post by PhillHS »

Hi all,

Environment : Delphi 7, Windows 10 x64.

So my app is essentially based off SimpleBrowser2, but I get some odd errors with it, which seem to occur randomly. Whenever one of the errors occurs I also get an EOSError when quitting the application. (see screenshot)
Screenshot 2023-03-11 174520.png
For example I have a TCheckListBox, whcih I fill with links from the downloaded web page, My TCheckListBox has a popup menu assigned to it in it's PopupMenu property. Normally right clicking on the list brings up this menu, however it erratically fails to function, when it fails I always get the EOSError on exiting.

My dpr contains :

Code: Select all

program MiniWeb;

uses
  Forms,
  uCEFApplication,
  CefInit,
  MainFormUnit in 'MainFormUnit.pas' {BrowserForm},
  other units cut for brevity...... 

{$R *.RES}

// CEF3/4 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
{$SetPEFlags $20}

begin
  CreateGlobalCEFApp;


  if GlobalCEFApp.StartMainProcess then
  begin
    Application.Initialize;
    Application.CreateForm(TBrowserForm, BrowserForm);
    Application.CreateForm(TSourceForm, SourceForm);
    Application.CreateForm(TPreviewForm, PreviewForm);
    Application.CreateForm(THelpForm, HelpForm);
    Application.CreateForm(TAddRuleForm, AddRuleForm);
    Application.CreateForm(TScriptEditor, ScriptEditor);
    Application.Run;
  END;

  GlobalCEFApp.Free;
end.
CreateGlobalCEFApp; is contained in it's own unit :

Code: Select all

unit CefInit;

interface

USES	uCEFApplication,Windows, Messages, SysUtils, Classes,MainFormUnit;

procedure CreateGlobalCEFApp;

implementation


procedure CreateGlobalCEFApp;
begin

  GlobalCEFApp                      := TCefApplication.Create;
  GlobalCEFApp.EnablePrintPreview   := True;

  GlobalCEFApp.FrameworkDirPath     := 'cef';
  GlobalCEFApp.ResourcesDirPath     := 'cef';
  GlobalCEFApp.LocalesDirPath       := 'cef\locales';
  GlobalCEFApp.cache                := 'cef\cache';
  GlobalCEFApp.UserDataPath         := 'cef\UserData';
end;


end.
Any idea what may be causing this and how to fix it.

Cheers.

Phill.
You do not have the required permissions to view the files attached to this post.
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Errrors on closing app, and odd behavior.

Post by salvadordf »

Hi,

Check that the application follows the destruction steps described in the code comments of the SimpleBrowser2 demo.

The SimpleBrowser2 demo uses the same EXE for all the CEF subprocesses. This configuration might cause problems if some unit in your application has an initialization and finalization section that tries to open some resource that it's not supposed to be opened by several processes at the same time, like databases.

If this is your case then use a different EXE for the CEF subprocesses as shown in the SubProcess demo.
Post Reply