Scenario:
- A TPageControl with two TTabSheets
- A TWebBrowser on the non-visible tab sheet
- WebBrowser->Navigate called during form creation
If the user simply runs the form and exits, then during application shutdown, an access violation is generated:
First chance exception at $507C1413. Exception class $C0000005 with message 'access violation at 0x507c1413: read of address 0x00000010'. Process Project1.exe (3464)
The call stack in the debugger contains only a single entry, which suggests that the call stack is being corrupted:
:507c1413 ; C:\Program Files (x86)\Embarcadero\Studio\16.0\bin\vcl220.bpl
(Another application shows the call stack as having a single entry of IsFormSizeStored
.)
Switching to the browser's tab sheet, either in code or in the UI, avoids the problem. Not calling Navigate avoids the problem.
Observed in XE4 and XE8.
What's the best way of fixing this?
WebBrowser->Navigate
to a different location (such asAfterConstruction
) to allow the form to be fully created first?