Skip to content

AV with certain method signature #8

@sglienke

Description

@sglienke

I experience an exception (tried in Delphi 10.1 and 11) with the following code on Win64:

program TinyInvokeBug64bit;

{$APPTYPE CONSOLE}

uses
  System.SysUtils,
  Tiny.Rtti,
  Tiny.Invoke;

type
  TEventArgs = record i: Integer; s: string; v: Variant; end;
  TEventWithStackParams = procedure(const Value1: Int64; const Value2: Single;
    const Value3: Double; const Value4: Extended; const Value5: TEventArgs) of object;

  TTest = class
    procedure Handle(const Value1: Int64; const Value2: Single;
      const Value3: Double; const Value4: Extended; const Value5: TEventArgs);
  end;

procedure TTest.Handle(const Value1: Int64; const Value2: Single;
  const Value3: Double; const Value4: Extended; const Value5: TEventArgs);
begin
  Assert(Value1 = 42);
  Assert(Value2 = 43);
  Assert(Value3 = 44);
  Assert(Value4 = 45);
  Assert(Value5.i = 46);
  Assert(Value5.s = '47');
  Assert(value5.v = 48);
end;

procedure Main;
var
  sig: TRttiSignature;
  args: TEventArgs;
  dump: TRttiInvokeDump;
begin
  args.i := 46;
  args.s := '47';
  args.v := 48;
  sig.Init(TypeInfo(TEventWithStackParams));
  sig.Invoke(dump, @TTest.Handle, nil, [42, 43, 44, 45, TValue.From(args)]);
end;
begin
  Main;
end.

It looks like it happens inside the UniversalInvokeFunc that gets called from TRttiInvokeBuffer.Invoke

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions