Hi there,
I came over a strange thing today, that is:
I have got an object A that manages several other objects and always passes them a reference to itself - using @self in the code.
In two different procedures of this object I evaluate @self:
[tt]
procedure A.Proc1 (...);
var
temp: Pointer;
begin
temp := @self;
...
end;
procedure A.Proc2 (...);
var
temp: Pointer;
begin
temp := @self;
...
end;
[/tt]
temp in Proc1 gets set to $12F738 (which is right), temp in Proc2 gets set to $12F6DC (throws a pointer exception later, as the value is wrong). Proc2 is executed after Proc1. I do not copy / clone / ... object A, so I do not have a clue why this happens.
I have already used a workaround for this (I use another variable that holds the first, right, value of @self) - but this is a stupid workaround...![[evil] [evil] [evil]](/data/assets/smilies/evil.gif)
Does anyone have an idea?
Thanks,
Anne
I came over a strange thing today, that is:
I have got an object A that manages several other objects and always passes them a reference to itself - using @self in the code.
In two different procedures of this object I evaluate @self:
[tt]
procedure A.Proc1 (...);
var
temp: Pointer;
begin
temp := @self;
...
end;
procedure A.Proc2 (...);
var
temp: Pointer;
begin
temp := @self;
...
end;
[/tt]
temp in Proc1 gets set to $12F738 (which is right), temp in Proc2 gets set to $12F6DC (throws a pointer exception later, as the value is wrong). Proc2 is executed after Proc1. I do not copy / clone / ... object A, so I do not have a clue why this happens.
I have already used a workaround for this (I use another variable that holds the first, right, value of @self) - but this is a stupid workaround...
![[evil] [evil] [evil]](/data/assets/smilies/evil.gif)
Does anyone have an idea?
Thanks,
Anne