mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[r=kb] memory leak fixes
This commit is contained in:
@@ -20,10 +20,13 @@
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.impl.ProjectLifecycleListener;
|
||||
import com.intellij.psi.util.PsiModificationTracker;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.HashMap;
|
||||
@@ -42,6 +45,12 @@ public class IconDeferrerImpl extends IconDeferrer {
|
||||
clear();
|
||||
}
|
||||
});
|
||||
connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener.Adapter() {
|
||||
@Override
|
||||
public void afterProjectClosed(@NotNull Project project) {
|
||||
clear();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
|
||||
@@ -1183,7 +1183,9 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
button.dispose();
|
||||
myId2StripeButton.remove(id);
|
||||
//
|
||||
myId2FocusWatcher.remove(id);
|
||||
ToolWindowFocusWatcher watcher = (ToolWindowFocusWatcher)myId2FocusWatcher.remove(id);
|
||||
watcher.deinstall();
|
||||
|
||||
// Destroy decorator
|
||||
final InternalDecorator decorator = getInternalDecorator(id);
|
||||
decorator.dispose();
|
||||
@@ -1946,11 +1948,17 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
*/
|
||||
private final class ToolWindowFocusWatcher extends FocusWatcher {
|
||||
private final String myId;
|
||||
private final ToolWindowImpl myToolWindow;
|
||||
|
||||
|
||||
private ToolWindowFocusWatcher(final ToolWindowImpl toolWindow) {
|
||||
myId = toolWindow.getId();
|
||||
install(toolWindow.getComponent());
|
||||
myToolWindow = toolWindow;
|
||||
}
|
||||
|
||||
public void deinstall() {
|
||||
deinstall(myToolWindow.getComponent());
|
||||
}
|
||||
|
||||
protected boolean isFocusedComponentChangeValid(final Component comp, final AWTEvent cause) {
|
||||
|
||||
Reference in New Issue
Block a user