Page 1 of 1

Bug or not

Posted: Thu Aug 11, 2022 9:29 pm
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

Re: Bug or not

Posted: Fri Aug 12, 2022 1:11 pm
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.

Re: Bug or not

Posted: Sat Aug 13, 2022 12:21 pm
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.

Re: Bug or not

Posted: Sat Aug 13, 2022 4:57 pm
by salvadordf
Try to use the same variables/fields as much as possible and see if there's any memory leak.