diff --git a/platform/lang-impl/src/com/intellij/ide/util/scopeChooser/ScopeChooserCombo.java b/platform/lang-impl/src/com/intellij/ide/util/scopeChooser/ScopeChooserCombo.java index fbc9a6856954..70b8a52869a2 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/scopeChooser/ScopeChooserCombo.java +++ b/platform/lang-impl/src/com/intellij/ide/util/scopeChooser/ScopeChooserCombo.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.util.scopeChooser; import com.intellij.ide.DataManager; @@ -36,6 +36,13 @@ import java.awt.event.ActionEvent; import java.util.Comparator; import java.util.List; +/** + * Instances of ScopeChooserCombo must be disposed when the corresponding dialog or settings page is closed. Otherwise + * listeners registered in init() cause memory leak.

+ * Example: if ScopeChooserCombo is used in a + * DialogWrapper subclass, call Disposer.register(getDisposable(), myScopeChooserCombo), where + * getDisposable() is DialogWrapper's method. + */ public class ScopeChooserCombo extends ComboboxWithBrowseButton implements Disposable { public static final int OPT_LIBRARIES = 0x1;