IDEA-197838 Project leak via animated icon in PluginsGroupComponentWithProgress

This commit is contained in:
Alexander Lobas
2018-08-29 15:15:51 +03:00
parent 16784fba4f
commit b603ac04d8
3 changed files with 17 additions and 10 deletions
@@ -464,6 +464,7 @@ public class PluginManagerConfigurableNew
public void disposeUIResources() {
myPluginsModel.toBackground();
Disposer.dispose(mySearchUpdateAlarm);
myTrendingSearchPanel.loading(false);
if (myShutdownCallback != null) {
myShutdownCallback.run();
@@ -16,15 +16,7 @@ import java.awt.*;
* @author Alexander Lobas
*/
public class PluginsGroupComponentWithProgress extends PluginsGroupComponent {
private AsyncProcessIcon myIcon = new AsyncProcessIcon.Big("Loading") {
@NotNull
@Override
protected Rectangle calculateBounds(@NotNull JComponent container) {
Dimension size = container.getSize();
Dimension iconSize = getPreferredSize();
return new Rectangle((size.width - iconSize.width) / 2, (size.height - iconSize.height) / 2, iconSize.width, iconSize.height);
}
};
private AsyncProcessIcon myIcon = new CenteredIcon();
public PluginsGroupComponentWithProgress(@NotNull LayoutManager layout,
@NotNull EventHandler eventHandler,
@@ -88,4 +80,18 @@ public class PluginsGroupComponentWithProgress extends PluginsGroupComponent {
Disposer.dispose(myIcon);
myIcon = null;
}
private static class CenteredIcon extends AsyncProcessIcon.Big {
public CenteredIcon() {
super("Loading");
}
@NotNull
@Override
protected Rectangle calculateBounds(@NotNull JComponent container) {
Dimension size = container.getSize();
Dimension iconSize = getPreferredSize();
return new Rectangle((size.width - iconSize.width) / 2, (size.height - iconSize.height) / 2, iconSize.width, iconSize.height);
}
}
}
@@ -116,7 +116,7 @@ public abstract class SearchResultPanel {
protected abstract void handleQuery(@NotNull String query, @NotNull PluginsGroup result);
private void loading(boolean start) {
public void loading(boolean start) {
PluginsGroupComponentWithProgress panel = (PluginsGroupComponentWithProgress)myPanel;
if (start) {
panel.startLoading();