TChromium.RetrieveHTML is an asynchronous procedure and a TTimer uses a low-priority message : WM_TIMER.
TChromium.RetrieveHTML uses a TCustomCefStringVisitor that calls an internal TChromium procedure to return the HTML in the TChromium.OnTextResultAvailable event.
If you stress your CPU and you try to close the app then the remaining WM_TIMER messages in the queue could cause problems.
The safest way to call TChromium.RetrieveHTML repeatedly would be to wait for the previous TChromium.OnTextResultAvailable event before enabling TTimer again.
Follow these steps if you try to close your app :
- Use a boolean global variable to keep your TTimer disabled. You should not enable your timer again if that variable is set.
- Disable the TTimer.
- Wait for any remaining TChromium.OnTextResultAvailable event to be received.
- Start the "destruction sequence" for TChromium.
- Close your app when TChromium.OnBeforeClose is received.