I'm using the Off-screen rendering component TChromiumOSR in the dcef3 package - the Delphi wrapper for Chromium-embedded library.
Situation
FormA contains a TChromiumOSR and paints the output.
Modal FormB modifies the web page by executing some js code against FormA.TChromiumOSR.
Issue
The TChromiumOSR.OnPaint event (in FormA) is not triggered until FormB.ShowModal returns.
Notes
- There is no such issue in the above described situation (under a modal form) with the standard
TChromiumcontrol.
I assume the `TForm.ShowModal' method only blocks the input of the background forms, but not the painting?
Or does it caused by the internal working of cef3?
Anyway, how to solve it? Thanks.
Ok, I found the source of the problem - it's not a bug in cef3 or dcef3 but was caused by my improper use of Delphi Event Bus, and the following are the steps to reproduce the issue:
jscode to update the web page insidedcef3, which in turn will trigger some of thedcef3events (in the main thread), and here is where the program stuck - since theTEventBus.Post()method is locked by aTCriticalSection.Solution: In Step #1, don't call
ShowModaldirectly, but use a technique such asPostMessagewinapi to 'delay' the execution ofShowModal.I'm not sure if I have described it clearly...