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.

Bug or not

Post Reply
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Bug or not

Post by dilfich »

Hi, I already asked about it once and as far as I remember the answer would be that there is a problem in Windows. Unfortunately, I couldn't find the topic.
Just now, I quite accidentally noticed that this happens due to frequent calls to TCustomResourceHandler.Create.

In the procedure I have a flag TCustomResourceHandler.ProcessRequest which interrupts
Chromium_On Get Resource Handler...
if LoadRSR then resourcehandler := Handler; since after the document is loaded, the elements are loaded from the network.

And if you do this repeatedly, problems begin in Windows. The way the clipboard stops working, the context menu is buggy and many programs stop working. Only a reboot will help.

Previously, I thought that this was due to the repeated re-creation of the browser, perhaps it is) But if you use one instance, the problem will be the same.

I took a similar method to replace LoadString, which was removed from CEF. This option would also suit if it were not for this problem.
What am I doing wrong?

Windows is buggy
Image
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Bug or not

Post by salvadordf »

This is the thread you're looking for :
https://www.briskbard.com/forum/viewtopic.php?f=8&t=726

Try reducing the browser creation frequency.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Bug or not

Post by dilfich »

The browser is not being recreated, it is working. The problem occurs if you use TCustomResourceHandler frequently.

Code: Select all

procedure LoadResource(const html, url: string);
var
  TempStream : TStringStream;
begin
  TempStream := nil;
  try
    try
      TempStream := TStringStream.Create;
      TempStream.WriteString(html);
      FHandler   := TCustomResourceHandler.Create(nil, nil, '', nil, TStream(TempStream), CefGetMimeType('html'));
      LoadRSR:= True;
      Chromium1.LoadUrl( url );
    except
      on e : exception do
       ShowMessage('Error: ' + e.Message);
    end;
  finally
    if (TempStream <> nil) then FreeAndNil(TempStream);
  end;
end;
 
When html is loaded, Load RSR is triggered and then the loading of elements from the network works, those in html

Code: Select all

TCustomResourceHandler.ProcessRequest(....
LoadRSR     := False;

Chromium_OnGetResourceHandler.....
  if LoadRSR then begin  aResourceHandler := FHandler;
When I finish working with the loaded page, which is after 10-60 seconds, I repeat the LoadResource procedure. Well, so many times.
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Bug or not

Post by salvadordf »

Try to use the same variables/fields as much as possible and see if there's any memory leak.
Post Reply