3
votes

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?

1
Cannot reproduce in Delphi XE3 navigating to google.com. - TLama
@TLama - It appears to be new in XE4. I no longer have XE3 installed, but I just tried XE2, and I cannot reproduce it there. - Josh Kelley
Did you try moving the call to WebBrowser->Navigate to a different location (such as AfterConstruction) to allow the form to be fully created first? - Ken White
@KenWhite - Moving to FormShow doesn't help. - Josh Kelley
Have you tried cleaning up on shutdown? (E.g. navigate to about:blank) - Ondrej Kelle

1 Answers

1
votes

Following @TOndrej's suggestion, I added a FormClose event handler to delete the TWebBrowser control before the application shuts down.

This issue has been logged on the RAD Studio Quality Portal.