Unusable form after naming a component "Owner"
- Lazarus/FPC Version: Lazarus 2.3.0 (rev main-2_3-2878-g8043f78a) FPC 3.2.2 i386-win32-win32/win64
- Operating System: Windows 11 (64 bit); the issue occurs also on Linux.
- CPU / Bitness: tested both 32-bit and 64-bit IDEs
What happens
When a component on a form is named as "Owner" the project can not be compiled any more - this is as expected. But the issue which worries me here is that the component name cannot be reverted back to some allowed identifier within the IDE any more. Attempting this results in the error
'Owner' is already used by TReader/TWriter. Please choose another name.
Resetting the incorrect name is only possible by direct editing the lfm file. Since this normally is not recommended for unexperienced users I consider this a serious bug (because only an unexperienced user would give a component the name "Owner").
This issue was mentioned in forum thread https://forum.lazarus.freepascal.org/index.php/topic,62461.msg472342.html.
What did you expect
It should be possible to change an illegal name in the Object Inspector by all means. Ideally, it should not be possible to enter an illegal component name in the Object Inspector in the first place.
Steps to reproduce
- Create a new project.
- Add a TButton and change its name in the Object Inspector to "Owner".
- Compile --> Error "unit1.pas(15,5) Error: Duplicate identifier "Owner" / unit1.pas(15,10) Hint: Identifier already defined in unit CLASSES: classesh.inc at line 1988"
- In the Object Inspector go to the button's Name property and type something allowed, such as "Button1". When pressing ENTER the Message "'Owner' is already used by TReader/TWriter. Please choose another name." appears --> It is not possible to revert the error made when the component was named "Owner".
- The only way to recover the form is to open the lfm and pas files in an external editor and change the occurrences of "Owner" here.