mem leaks in evaluator hint

This commit is contained in:
Konstantin Bulenkov
2014-09-24 12:36:29 +02:00
parent 02b61cbc03
commit 521fca36d8
2 changed files with 14 additions and 2 deletions
@@ -28,7 +28,6 @@ import com.intellij.openapi.actionSystem.ShortcutSet;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.impl.EditorImpl;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.project.DumbAwareAction;
@@ -116,7 +115,6 @@ public class XValueHint extends AbstractValueHint {
boolean result = super.showHint(component);
if (result && getType() == ValueHintType.MOUSE_OVER_HINT) {
myDisposable = Disposer.newDisposable();
Disposer.register(((EditorImpl)getEditor()).getDisposable(), myDisposable);
ShortcutSet shortcut = ActionManager.getInstance().getAction("ShowErrorDescription").getShortcutSet();
new DumbAwareAction() {
@Override
@@ -130,6 +128,15 @@ public class XValueHint extends AbstractValueHint {
return result;
}
@Override
protected void onHintHidden() {
super.onHintHidden();
if (myDisposable != null) {
Disposer.dispose(myDisposable);
myDisposable = null;
}
}
@Override
public void hideHint() {
super.hideHint();
@@ -194,6 +194,7 @@ public abstract class AbstractValueHint {
if (myHideRunnable != null) {
myHideRunnable.run();
}
onHintHidden();
}
});
@@ -211,6 +212,10 @@ public abstract class AbstractValueHint {
return true;
}
protected void onHintHidden() {
}
protected boolean isHintHidden() {
return myHintHidden;
}