Wrong data for pointer method and "External SIGSEGV" (type helper)
Original Reporter info from Mantis: hnb
-
Reporter name: Maciej Izak
Original Reporter info from Mantis: hnb
- Reporter name: Maciej Izak
Description:
During making pointer to method for type helper method, compiler stores wrong value in data field. (value of variable instead of pointer to variable):
uses
Classes;
type
TInt32Helper = record helper for Int32
procedure Foo(Sender: TObject);
end;
procedure TInt32Helper.Foo(Sender: TObject);
begin
Writeln(Self);
end;
var
i: Int32 = 10;
m: TNotifyEvent;
begin
m := i.Foo;
// Data is equal 10 (!) but should be equal to @i
WriteLn(Int32(TMethod(m).Data));
ReadLn;
// TMethod(m).Data := @i; < workaround for bug
m(nil); // External SIGSEGV!
ReadLn;
end.
Mantis conversion info:
- Mantis ID: 26177
- Version: 2.7.1
- Fixed in version: 3.0.0
- Fixed in revision: 28160
- Monitored by: » @PascalDragon (Sven Barth)
- Target version: 3.0.0