ghkweon / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

Calling script functions from a modal dialog gives AVs #436

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Similar issue to 433.
Instead of an object it is a strongly typed RTTIVariant.

Here is the script.

var cmp : RTTIVariant<System.Classes.TComponent>;

procedure Run();
begin
  cmp := CreateComponent(Form1, 'System.Classes.TComponent');
  cmp.Tag := 99;

  Form1.ShowModal();
  showMessage(IntToStr(cmp.Tag));
  Form1.Release();
end;

procedure Button1Click();
begin
  showMessage(IntToStr(cmp.Tag));
end;

Form1 is a global RTTIVariant defined on the Delphi side. Form1 calls 
Button1Click() which gives an AV. 
After closing Form1 the message "99" is shown so cmp is still alive and well.

Full source attached.

Original issue reported on code.google.com by tom.robe...@gmail.com on 10 Sep 2013 at 10:35

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Eric,
Is this issue a DWS issue or maybe something I have done? Appreciate any 
feedback on this .

cheers

tom

Original comment by tom.robe...@gmail.com on 18 Dec 2013 at 1:21

GoogleCodeExporter commented 8 years ago
This seems to work on the current SVN version, though I had to adapt your 
sample to make it compatible with Delphi XE.

Original comment by zar...@gmail.com on 18 Dec 2013 at 3:27

GoogleCodeExporter commented 8 years ago
Yes it does work with the latest gear. 
Thanks

Original comment by tom.robe...@gmail.com on 18 Dec 2013 at 10:58

GoogleCodeExporter commented 8 years ago

Original comment by zar...@gmail.com on 19 Dec 2013 at 7:48