mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-171343 IdeStatusBarImpl has a leak of a widget component
GitOrigin-RevId: f9c0799e71ab982a65b13f8fb27a774942d64b85
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f073bcc86d
commit
30f2890baf
@@ -99,7 +99,7 @@ open class IdeStatusBarImpl @ApiStatus.Internal constructor(
|
||||
private val widgetMap = LinkedHashMap<String, WidgetBean>()
|
||||
private var leftPanel: JPanel? = null
|
||||
|
||||
private val rightPanelLayout = GridBagLayout()
|
||||
private var rightPanelLayout = GridBagLayout()
|
||||
private val rightPanel: JPanel
|
||||
|
||||
private val centerPanel: JPanel
|
||||
@@ -747,6 +747,7 @@ open class IdeStatusBarImpl @ApiStatus.Internal constructor(
|
||||
|
||||
val targetPanel = getTargetPanel(bean.position)
|
||||
targetPanel.remove(bean.component)
|
||||
recreateLayoutIfIsEmptyRightPanel(targetPanel)
|
||||
targetPanel.revalidate()
|
||||
Disposer.dispose(bean.widget)
|
||||
fireWidgetRemoved(id)
|
||||
@@ -755,6 +756,17 @@ open class IdeStatusBarImpl @ApiStatus.Internal constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun recreateLayoutIfIsEmptyRightPanel(panel: JPanel) {
|
||||
if (panel !== rightPanel && panel.components.none { it.isVisible }) return
|
||||
|
||||
// Workaround of a bug in AWT:
|
||||
// GridBagLayout.componentAdjusting is not set to NULL after removing the last visible child component.
|
||||
// That leads to a leak of the StatusBarWidget component, and that leads to a situation when the plugin can't be properly unloaded.
|
||||
rightPanelLayout = GridBagLayout()
|
||||
panel.layout = rightPanelLayout
|
||||
sortRightWidgets()
|
||||
}
|
||||
|
||||
override fun updateWidget(id: String) {
|
||||
EdtInvocationManager.invokeLaterIfNeeded {
|
||||
val widgetComponent = getWidgetComponent(id)
|
||||
|
||||
Reference in New Issue
Block a user