[Lazarus] Weird object variables access [SOLVED] - Delphi mode bug!

Michael Van Canneyt michael at freepascal.org
Tue Oct 24 23:18:24 CEST 2017



On Tue, 24 Oct 2017, Giuliano Colla wrote:

> Il 24/10/2017 14:10, Michael Van Canneyt via Lazarus ha scritto:
>> A valid method can never be stored in a pointer, since the former is 
>> actually 2 pointers (method/data) and the latter is just 1 pointer.
>> 
>> That the assignment is valid is Delphi compatible: only the procedure
>> address is copied. 
>
> I can confirm it as an fpc bug.

No, I'm sorry to say that IMO you did not. I looked at your code.

It simply works by accident in Delphi, because you are calling a method of the 
same object as the caller. Try calling a method of another object, and displaying 
the classname and make sure you trash the registers between the assignment
of the method pointer and actually calling it.

Michael.


More information about the Lazarus mailing list