开发者

Is an eventhandler removed if the control it is set on removed?

We are developing an appli开发者_如何学JAVAcation that looks like this:

Mainwindow - PaneGroup - Pane

What we want to do is add a handler (AddHandler Pane, AddressOf MethodName) on the mainwindow and throw the event in the Pane. When we want something to change on a collection in the mainwindow, we throw that event in the Pane.

My question is if the pane is removed from the panegroup (doesn't exist anymore), does that handler still live on the mainwindow?


The pane holds a reference to the main window. When the pane is removed from the pane group it will eventually be garbage collected and in that process, the assigned event handlers will be cleared, too.

So, as long as the main window lives longer than the pane you have no problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜