WebGMaps Access Violation

I am using Delphi Tokyo 10.2 update 3 and TWebGMaps ver 2.9.5.0.

I have a form hosting a TWebGMaps control:

object Form3: TForm3
  Left = 0
  Top = 0
  Caption = 'Map'
  ClientHeight = 231
  ClientWidth = 505
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poMainFormCenter
  PixelsPerInch = 96
  TextHeight = 13
  object WebGMaps1: TWebGMaps
    Left = 0
    Top = 0
    Width = 505
    Height = 231
    Align = alClient
    Clusters = <>
    Markers = <>
    Polylines = <>
    Polygons = <>
    Directions = <>
    MapOptions.DefaultLatitude = 48.859040000000000000
    MapOptions.DefaultLongitude = 2.294297000000000000
    Routing.PolylineOptions.Icons = <>
    StreetViewOptions.DefaultLatitude = 48.859040000000000000
    StreetViewOptions.DefaultLongitude = 2.294297000000000000
    MapPersist.Location = mplInifile
    MapPersist.Key = 'WebGMaps'
    MapPersist.Section = 'MapBounds'
    PolygonLabel.Font.Charset = DEFAULT_CHARSET
    PolygonLabel.Font.Color = clBlack
    PolygonLabel.Font.Height = -16
    PolygonLabel.Font.Name = 'Arial'
    PolygonLabel.Font.Style = []
    TabOrder = 0
    Version = '2.9.5.0'
  end
end

When I execute run code twice, I encounter Access Violation on and off:
var F: TForm3;
begin
  F := TForm3.Create(nil);
  try
    F.ShowModal;
  finally
    F.Release;
  end;
end;

If using FastMM4 as memory manager, the Access Violation always happen.

Hi,


I have not been able to reproduce this issue.
Can you please provide a ready to run sample project that demonstrates the issue so I can further investigate this?
Sample projects can be emailed to mailto:help@tmssoftware.com

Please note: We are experiencing the same issue. 

Our findings, if you comment out the new hooks stuff, the AV goes away (or exit early)


<DELPHI>
procedure TWebGMaps.InstallHook;
var
  frm: TCustomForm;
begin
  exit; //<- Bail out to avoid AV

  if not Assigned(HookedForms) then
    HookedForms := TList.Create;

  if not Assigned(HookedClients) then
    HookedClients := TList.Create;

  frm := GetParentForm(Self);
  HookedClients.Add(self);

  if HookedForms.IndexOf(frm) = -1 then
  begin
    HookedForms.Add(frm);

    {$IFDEF DELPHI_UNICODE}
    OldWndProc := TFarProc(GetWindowLongPtr(frm.Handle, GWL_WNDPROC));
    NewWndProc := MakeObjectInstance(HookWndProc);
    SetWindowLongPtr(frm.Handle, GWL_WNDPROC, LInteger(NewWndProc));
    {$ENDIF}

    {$IFNDEF DELPHI_UNICODE}
    OldWndProc := TFarProc(GetWindowLong(frm.Handle, GWL_WNDPROC));
    NewWndProc := MakeObjectInstance(HookWndProc);
    SetWindowLong(frm.Handle, GWL_WNDPROC, LInteger(NewWndProc));
    {$ENDIF}

    FHooked := true;
  end;
end;

procedure TWebGMaps.HookWndProc(var Msg: TMessage);
var
  i: integer;
  wgm: TWebGMaps;
  frm: TCustomForm;
begin
  exit; // <-Bail out to avoid AV

  frm := GetParentForm(Self);
  if Assigned(frm) and not (csDestroying in frm.ComponentState) then
    Msg.Result := CallWindowProc(OldWndProc, frm.Handle, Msg.Msg, Msg.wParam, Msg.lParam);

  if Msg.Msg = WM_CLOSE then
  begin
    RemoveHook;

    if Assigned(HookedClients) then
    begin
      for i := HookedClients.Count - 1 downto 0 do
      begin
        wgm := TWebGMaps(HookedClients.Items);
        frm := GetParentForm(wgm);

        if (frm = GetParentForm(Self)) and (frm = Application.MainForm) then
        begin
          wgm.Free;
          HookedClients.Delete(i);
        end;
      end;

      if HookedClients.Count = 0 then
        FreeAndNil(HookedClients);
    end;
  end;
end;

What exact Windows version is this?

There have been Windows 10 updates that introduced breaking changes in IE unfortunately.