From c4f84bc8dd77023afbb7d1922c183db2b6520bb3 Mon Sep 17 00:00:00 2001 From: Alexander Doroshko Date: Fri, 24 Apr 2020 13:08:43 +0300 Subject: [PATCH] Add javadoc to ScopeChooserCombo asking not to forget to dispose ScopeChooserCombo instances to prevent memory leak GitOrigin-RevId: a41de9cb2da075a938b916ea23278c423e47d481 --- .../ide/util/scopeChooser/ScopeChooserCombo.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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;