3

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?

Josh Kelley
  • 56,064
  • 19
  • 146
  • 246
  • Cannot reproduce in Delphi XE3 navigating to google.com. – TLama Jun 05 '15 at 13:36
  • @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 Jun 05 '15 at 14:01
  • 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 Jun 05 '15 at 14:29
  • @KenWhite - Moving to FormShow doesn't help. – Josh Kelley Jun 05 '15 at 15:07
  • Have you tried cleaning up on shutdown? (E.g. navigate to about:blank) – Ondrej Kelle Jun 05 '15 at 15:31
  • @TOndrej - Navigating to about:blank didn't work when I tried it (although I didn't make sure navigation finished). However, deleting the TWebBrowser instance within FormClose does work. Thanks for the suggestion. – Josh Kelley Jun 05 '15 at 19:18

1 Answers1

1

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.

Josh Kelley
  • 56,064
  • 19
  • 146
  • 246