Es kommt zu einer Zugriffsverletzung, wenn folgender Eventhandler hinzugefügt wird:
TEventTest = procedure(const AInterface: IInterface; var AKey: Word; var AKeyChar: WideChar; AShift: TShiftState) of object;
Delphi-Quellcode:
type
TEventTest = procedure(const AInterface: IInterface; var AKey: Word; var AKeyChar: WideChar; AShift: TShiftState) of object;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
_EventTest : TEvent<TEventTest>;
procedure ProcessEventTest(const AInterface: IInterface; var AKey: Word; var AKeyChar: WideChar; AShift: TShiftState);
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Key : Word;
KeyChar : WideChar;
begin
_EventTest.EventHandler.Add(Self.ProcessEventTest);
Key := 0;
KeyChar := 'K';
_EventTest.Invoke(nil, Key, KeyChar, []);
end;
procedure TForm1.ProcessEventTest(const AInterface: IInterface; var AKey: Word; var AKeyChar: WideChar; AShift: TShiftState);
begin
end;
Fehler tritt in
Unit DSharp.Core.Events.pas in Zeile 247 auf:
Delphi-Quellcode:
TValue.Make(Pointer(PNativeInt(@Params.Stack[LOffset])^),
FParameters[i].ParamType.Handle, LArgs[i + 1]);