Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] Re: Bug? ElementChangedListener not properly released....

Hi all,

(My initial e-mail bounced because I send it to dltk-dev-request
instead of dltk-dev.)

A possible solution for the Ruby Plugin will be to uninstall the
folding provider in the dispose of RubyEditor:

	public void dispose() {
		ISourceViewer sourceViewer = getSourceViewer();
		if (sourceViewer instanceof ITextViewerExtension)
			((ITextViewerExtension) sourceViewer)
					.removeVerifyKeyListener(fBracketInserter);
///////////////////
		if (fFoldingProvider != null)
			fFoldingProvider.uninstall();
///////////////////
		super.dispose();
	}


Well, this only if you don't decide to provide an another protected
empty method in the ScriptEditor (solution that I would prefer):

	protected IFoldingStructureProvider getFoldingStructureProvider() {
		return null;
	}
///////////////////
	protected void uninstallFoldingStructureProvider() {
	}
///////////////////
	...


In this case the ScriptEditor.dispose() just has to call this method
and clients reimplement it.

Regards,
Gabriel

On Sun, Apr 5, 2009 at 1:40 PM, Gabriel Petrovay
<gabriel.petrovay@xxxxxxxxxx> wrote:
> Hi all,
>
> (Retrying send: my first message bounced :( Why? )
>
> I have just discovered that the ElementChangedListener inside the
> AbstractASTFoldingStructureProvider class is not released when the
> folding structure provider is uninstalled. Am I responsible to release
> it from my extended provider? I guess not. Also the Ruby plugin
> suffers from the same problem. I am talking about DLTK 1.0
>
> To check this define the constructor of your extended folding provider
> class and write the following line:
> public RubyFoldingStructureProvider() {
>       System.out.println(ModelManager.getModelManager().deltaState.elementChangedListenerCount);
> }
>
> Now open and close a script file more times and watch the number of
> listeners growing.
>
> Regards,
> Gabriel
>
> --
> MSc Gabriel Petrovay
> MCSA, MCDBA, MCAD
> Mobile: +41(0)787978034
>



-- 
MSc Gabriel Petrovay
MCSA, MCDBA, MCAD
Mobile: +41(0)787978034


Back to the top