From d87dbd12d77e3f4d907a0dd08ac13ebf32b68b30 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 23 Jan 2017 16:56:04 +0300 Subject: [PATCH] close all tooltips for the project when it closes, avoid tooltips leaks --- .../notification/impl/NotificationsManagerImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java index a3c19ed911fa..296ad9a1c797 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java @@ -15,6 +15,7 @@ */ package com.intellij.notification.impl; +import com.intellij.codeInsight.hint.TooltipController; import com.intellij.icons.AllIcons; import com.intellij.ide.FrameStateManager; import com.intellij.ide.ui.laf.darcula.ui.DarculaButtonPainter; @@ -30,6 +31,7 @@ import com.intellij.openapi.application.ex.ApplicationEx; import com.intellij.openapi.project.DumbAwareRunnable; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; +import com.intellij.openapi.project.ProjectManagerAdapter; import com.intellij.openapi.startup.StartupManager; import com.intellij.openapi.ui.DialogWrapperDialog; import com.intellij.openapi.ui.MessageType; @@ -88,6 +90,15 @@ public class NotificationsManagerImpl extends NotificationsManager { public NotificationsManagerImpl() { ApplicationManager.getApplication().getMessageBus().connect().subscribe(Notifications.TOPIC, new MyNotificationListener(null)); + ApplicationManager.getApplication().getMessageBus().connect().subscribe(ProjectManager.TOPIC, new ProjectManagerAdapter() { + @Override + public void projectClosed(Project project) { + for (Notification notification : getNotificationsOfType(Notification.class, project)) { + notification.hideBalloon(); + } + TooltipController.getInstance().resetCurrent(); + } + }); } @Override