View Issue Details

IDProjectCategoryView StatusLast Update
0037163LazarusRTLpublic2020-09-02 22:54
ReporterRenato Ricci Assigned ToJuha Manninen  
Status resolvedResolutionfixed 
Product Version2.0.8 
Summary0037163: Event Handler error
DescriptionHello, I would like to report that Lazarus is not leting me clear/unlink an event when it is a TCollection..

Even when i habe 'Auto remove empty methods', the event is not unlinked when we emprty the method.

Please see the attachment for details..

Looks like a bug..

TagsNo tags attached.
Fixed in Revisionr63781
Attached Files


related to 0019563 resolvedJuha Manninen IDE doesnt remove method call in object inspector using weblaz 


Renato Ricci

2020-06-01 19:14


Screenshot_3.png (63,683 bytes)   
Screenshot_3.png (63,683 bytes)   

Juha Manninen

2020-06-02 08:39

developer   ~0123179

Can you please provide a simple example project to reproduce the error.

Renato Ricci

2020-06-04 16:02

reporter   ~0123221

Hi.. Please see attachment..

Steps to reproduce:

Active the 'Auto remove empty methods' on yout IDE and:

1) First, install the Package NewPackage.lpk
2) Open de Project Sample.
3) The sample project already has a Event on the component. Try to go to the code and clean the event.

You will see that IDE will remove the Method(since there is no code anymore), but the Event on the component is still there(not suppose to..)

Renato (131,911 bytes)
Screenshot_4.png (99,346 bytes)   
Screenshot_4.png (99,346 bytes)   

Juha Manninen

2020-06-04 23:08

developer   ~0123233

Yes I can reproduce now. Thanks for the good minimal example.
I only had to remove the "windows" unit here and it compiled.

What is the GroupDescendentsWith() call in procedure Register for?
I checked its implementation. It is empty.

Renato Ricci

2020-06-04 23:14

reporter   ~0123234

I think you can remove the GroupDescendentsWith() ate register procedure..

Renato Ricci

2020-06-04 23:28

reporter   ~0123235

Last edited: 2020-06-04 23:34

View 2 revisions

And there is another behavior that sometimes happens but I can not reproduce it always is that I dont know why, sometimes I can not set the event to '(none)'.. May be it is related to the above related behavior(Sample Project).
Screenshot_5.png (12,549 bytes)   
Screenshot_5.png (12,549 bytes)   

Renato Ricci

2020-08-15 13:49

reporter   ~0124899

Hi.. any news on this bug? Thanks

Juha Manninen

2020-08-16 10:55

developer   ~0124916

The job is done by function RemoveEmptyMethods() in unit EmptyMethodsDlg. You could study it if you have time and motivation. I plan to study it later, too.

Renato Ricci

2020-08-18 14:14

reporter   ~0124962

Thanks! Time I have.. but dont have knowledge :(. I will study it.. Thanks for now..

Juha Manninen

2020-08-18 19:44

developer   ~0124969

I got inspiration and finally was able to fix this, amazingly enough! :)
TCollectionItem does not inherit from TComponent and needs special treatment.
Unit ComponentTreeView has a little similar code. The Object Inspector tree also must show TCollections and TCollectionItems. I improved it a long time ago, it is coming back...
I recommend you to study code related to RTTI and published properties. It is useful.

Renato Ricci

2020-08-18 19:50

reporter   ~0124970

Thanks a lot!! Sure.. I will study RTTI...
By the way.. did you also notice that.. If you have an Tcollection event and you close the project and open it again, That event/procedure is unlinked from its event?
Take a try..


Renato Ricci

2020-08-18 21:09

reporter   ~0124972

Juha, is it possible to use the correction you've make on Lazarus 2.0.8? Thanks.

Juha Manninen

2020-08-19 09:50

developer   ~0124979

> If you have an Tcollection event and you close the project and open it again, That event/procedure is unlinked from its event?

TcollectionItem event, right? I did not see that. Only if the handler method is empty, it will be removed and unlinked.

> is it possible to use the correction you've make on Lazarus 2.0.8? Thanks.

I believe it is. You must apply first the refactoring commit r63780 and then r63781.
Or just use Lazarus trunk.

Please continue questions and discussions in mailing list or forum. A personal mail or PM is good, too.

Renato Ricci

2020-08-19 15:17

reporter   ~0124991

Thank you.

Issue History

Date Modified Username Field Change
2020-06-01 19:14 Renato Ricci New Issue
2020-06-01 19:14 Renato Ricci File Added: Screenshot_3.png
2020-06-02 08:39 Juha Manninen Note Added: 0123179
2020-06-04 16:02 Renato Ricci Note Added: 0123221
2020-06-04 16:02 Renato Ricci File Added:
2020-06-04 16:02 Renato Ricci File Added: Screenshot_4.png
2020-06-04 23:08 Juha Manninen Note Added: 0123233
2020-06-04 23:14 Renato Ricci Note Added: 0123234
2020-06-04 23:28 Renato Ricci Note Added: 0123235
2020-06-04 23:28 Renato Ricci File Added: Screenshot_5.png
2020-06-04 23:34 Renato Ricci Note Edited: 0123235 View Revisions
2020-08-15 13:49 Renato Ricci Note Added: 0124899
2020-08-16 10:55 Juha Manninen Note Added: 0124916
2020-08-18 14:14 Renato Ricci Note Added: 0124962
2020-08-18 19:28 Juha Manninen Assigned To => Juha Manninen
2020-08-18 19:28 Juha Manninen Status new => assigned
2020-08-18 19:44 Juha Manninen Status assigned => resolved
2020-08-18 19:44 Juha Manninen Resolution open => fixed
2020-08-18 19:44 Juha Manninen Fixed in Revision => r63781
2020-08-18 19:44 Juha Manninen LazTarget => -
2020-08-18 19:44 Juha Manninen Note Added: 0124969
2020-08-18 19:50 Renato Ricci Note Added: 0124970
2020-08-18 21:09 Renato Ricci Note Added: 0124972
2020-08-19 09:50 Juha Manninen Note Added: 0124979
2020-08-19 15:17 Renato Ricci Note Added: 0124991
2020-09-02 22:54 Juha Manninen Relationship added related to 0019563