diff options
author | teicher | 2003-12-19 16:23:37 +0000 |
---|---|---|
committer | teicher | 2003-12-19 16:23:37 +0000 |
commit | 2bde9414b1cf9a98ef5b1d54fac0341db2744d17 (patch) | |
tree | 3ab58eddc72af90fc8dead9af253a5323cda2a9a | |
parent | e66c32528cda7179e485248c35b8b5fe3e303435 (diff) | |
download | eclipse.platform.text-2bde9414b1cf9a98ef5b1d54fac0341db2744d17.tar.gz eclipse.platform.text-2bde9414b1cf9a98ef5b1d54fac0341db2744d17.tar.xz eclipse.platform.text-2bde9414b1cf9a98ef5b1d54fac0341db2744d17.zip |
fixed leaking control listener
-rw-r--r-- | org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java index 79563b7749b..7aeb2f1ea89 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java @@ -70,14 +70,21 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt */ class Closer implements ControlListener, MouseListener, FocusListener, DisposeListener, IViewportListener { + /** The shell that a <code>ControlListener</code> is registered with. */ + private Control fShell; + /** The control that a <code>MouseListener</code>, a<code>FocusListener</code> and a <code>DisposeListener</code> are registered with. */ + private Control fControl; + /** * Installs this closer on it's viewer's text widget. */ protected void install() { Control control= fContentAssistSubjectAdapter.getControl(); + fControl= control; if (Helper.okToUse(control)) { Control shell= control.getShell(); + fShell= shell; shell.addControlListener(this); control.addMouseListener(this); @@ -96,13 +103,15 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt * Uninstalls this closer from the viewer's text widget. */ protected void uninstall() { - Control control= fContentAssistSubjectAdapter.getControl(); + Control shell= fShell; + fShell= null; + if (Helper.okToUse(shell)) + shell.removeControlListener(this); + + Control control= fControl; + fControl= null; if (Helper.okToUse(control)) { - Control shell= control.getShell(); - if (Helper.okToUse(shell)) - shell.removeControlListener(this); - control.removeMouseListener(this); control.removeFocusListener(this); |