Community
Participate
Working Groups
In createPartControl(Composite), a DisposeListener is added to the provided parent composite. In dispose(), the listener is then removed from the part site's shell. The two controls are _not_ the same. There is no point in removing the listener from the shell because the shell didn't even have the listener in the first place. Also, the listeners are effectively destroyed/unreferenced when the widget is disposed so there really is no need for your code to even bother removing the listener.
Thanks for the report. We could save the parent in the constructor, then check for !isDisposed() before doing the remove. It does appear that the parent composite has already been disposed, so it is too late to remove the dispose listener, so there isn't any point in doing the remove. I'll just remove it with a comment.
I've removed the removeDisposeListener call. How did you spot the error? Have you seen other problems?
(In reply to comment #2) > I've removed the removeDisposeListener call. Thank you for your speedy response, Andrew. > How did you spot the error? I spotted the error while I was testing MAT on the Eclipse 4.1 SDK builds (see bug 332139). We don't have everything implemented yet so your getSite().getShell() call was actually causing an NPE (see bug 332140, that's a bug on our side that I will be fixing). I then looked at your code and noticed the strange pattern so I thought I'd raise it to your attention. > Have you seen other problems? Not yet...but I don't really know how to use MAT so I'm pretty sure I'm not really exercising it fully on 4.1 I don't think. :P