event in control was not clearly disposed.

  • Thread starter Thread starter wirawan
  • Start date Start date
W

wirawan

hi all

i had some problems and need your sugestion to solve it.
why event of controls that i have been disposed still alive and trigger
method had been bind to it.

best regards
wirawan
 
Hi,

Actually I'd think it's a flaw in the control's implementation. Anyhow, I'd
strongly recommend that you removed all event handlers before disposing a
control, because otherwise you are still implicitly holding references to
the control.
 
from now i have destroyed all event of a control before destroying it,
but i still wonder why the control's event is not disposed if i dont
remove the event by my self. do you have any references that you want to
share with me?

thanks
wirawan
 
wirawan,

Disposing a control will seldom do something.

Only objects can be disposed when there is no reference anymore to it or
from it.

(MainControl.remove(Childcontrol))

Because you probably doing that on a windowform, is the disposing done by
the implementation of Idisposable on a by the designer created form.

I hope this helps,

Cor
 
hi there,
just cause the control is disposed doesn't mean that it's still not around.
dispose is just a form of early clean up for resources etc.

so ok it's disposed by the object reference is still around so it will
correctly handle events it's suscribed to untill it's garbage collected.

regds
Brian
 
Back
Top