[vcs-log] remove listeners when tool window is unregistered

If tool window is unregistered before VcsLogTabsWatcher is disposed, stateChanged is called.
Instead of processing the event normally, listeners should be removed in this case.

EA-105323
This commit is contained in:
Julia Beliaeva
2017-08-10 19:36:38 +03:00
parent 4144cb9cca
commit 586a6c8336
2 changed files with 10 additions and 3 deletions
@@ -88,6 +88,10 @@ public class VcsLogTabsWatcher implements Disposable {
@Override
public void dispose() {
removeListeners();
}
private void removeListeners() {
myToolWindowManager.removeToolWindowManagerListener(myPostponedEventsListener);
if (myToolWindow != null) {
@@ -172,7 +176,10 @@ public class VcsLogTabsWatcher implements Disposable {
@Override
public void stateChanged() {
if (myToolWindow != null && myIsVisible != myToolWindow.isVisible()) {
if (myToolWindow == null) return;
if (myToolWindowManager.getToolWindow(TOOLWINDOW_ID) == null) {
removeListeners();
} else if (myIsVisible != myToolWindow.isVisible()) {
myIsVisible = myToolWindow.isVisible();
selectionChanged();
}
@@ -254,9 +254,9 @@ public class CommitPanel extends JBPanel {
String subject = separator > 0 ? fullMessage.substring(0, separator) : fullMessage;
String description = fullMessage.substring(subject.length());
return "<b>" +
getHtmlWithFonts(escapeMultipleSpaces(IssueLinkHtmlRenderer.formatTextWithLinks(myProject, subject)), Font.BOLD) +
escapeMultipleSpaces(IssueLinkHtmlRenderer.formatTextWithLinks(myProject, subject)) +
"</b>" +
getHtmlWithFonts(escapeMultipleSpaces(IssueLinkHtmlRenderer.formatTextWithLinks(myProject, description)));
escapeMultipleSpaces(IssueLinkHtmlRenderer.formatTextWithLinks(myProject, description));
}
@NotNull