And Another issue with Scripter v1.23 and newer

Well, I have just come across another issue with Scripter v1.23 and newer. I have come across a Access Violation when using a TScrPascalMemoStyler.

To reproduce the issue do the following:

  1. Load the Scripter Demo project.
  2. Add a TScrPascalMemoStyler to the form.
  3. Use the default name of ScrPascalMemoStyler1 for the Styler.
  4. Now modify the TForm.OnCreateEditor procedure to look like the following:
procedure TForm1.OnCreateEditor(Sender: TObject);
var
  AMenu: TMainMenu;
  AItem: TMenuItem;
  ASubItem: TMenuItem;
  c: integer;
  AOldImages: TCustomImageList;
begin
  {This callback event is only used to add an About options in the menu}
  if Sender is TForm then
  begin
    {Create about menu and "migrate" all items from popup to the about}
    AMenu := TIDEEditorForm(Sender).MainMenu1;

    AOldImages := AMenu.Images; //visual workaround
    AMenu.Images := nil;
    AItem := TMenuItem.Create(AMenu.Owner);
    AItem.Caption := 'About';
    AMenu.Items.Add(AItem);
    for c := 0 to PopupMenu1.Items.Count - 1 do
    begin
      ASubItem := TMenuItem.Create(AMenu.Owner);
      ASubItem.Caption := PopupMenu1.Items[c].Caption;
      ASubItem.OnClick := PopupMenu1.Items[c].OnClick;
      AItem.Add(ASuBItem);
    end;
    AMenu.Images := AOldImages;

    {Add Pascal Styler to the IDEMemo1}
    TIDEEditorForm(Sender).IDEMemo1.SyntaxStyles := ScrPascalMemoStyler1;
  end;
end;
  1. Select the IDEEngine1 icon on the Form.
  2. Remove the checkmark from the AutoStyler property.
  3. Build and Run the project
  4. Once the Scripter IDE Demo is displayed, click anywhere in the IDEMemo.

The following AV message is displayed:

---------------------------
Scripterproide
---------------------------
Access violation at address 007BA5D1 in module 'ScripterProIDE.exe'. Read of address 00000048.
---------------------------
OK   
---------------------------

To verify that the AV is with using the Styler, do the following:

  1. Select the IDEEngine1 icon on the form.
  2. Replace the checkmark for the AutoStyle property.
  3. Build and Run the project.
  4. Once the Scripter IDE Demo is window is displayed. Click anywhere in the IDEMemo.

At which point you will not get the AV.

I have also tried using the following lines in place of the ones in the above shown code.

    {Add Pascal Styler to the IDEMemo1}
    IDEEngine1.Memo.SyntaxStyles := ScrPascalMemoStyler1;

And I still get the AV when using the TScrPascalMemoStyler instead of the TIDEEngine's AutoStyle.

Thank you for the detailed report. We have fixed the issue, fix will be included in next release. Here is a patch you can use to apply it manually, if you need it right away.

idemain.pas.patch.zip (445 Bytes)

1 Like

Thx for the quick reply and fix. It is Syntax Highlighting is working as intended. And now AV when clicking on the IDEMemo.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.