Code Completion: Invalid event comparison in property setter
- Lazarus version:
4.99(75191de4)
Summary
The auto-completion function for the following code:
program Project1;
type
TEvent = procedure(Sender: TObject) of object;
{ TClass }
TClass = class
private
FTest: TEvent;
published
// Set caret after "SetTest" and press [Ctrl+Shift+C]
property Test: TEvent read FTest write SetTest;
end;
begin
end.
automatically creates an assignment procedure:
procedure TClass.SetTest(AValue: TEvent);
begin
if FTest=AValue then Exit;
FTest:=AValue;
end;
But this is an invalid event comparison, it should be:
- if FTest=AValue then Exit;
+ if SameMethod(TMethod(FTest), TMethod(AValue)) then Exit;