From 0aeee8ba1cb63cd30d16b004f1b79b7cfb738f3b Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Fri, 13 May 2022 15:34:15 +0200 Subject: [PATCH] IDEA-293835 ui: workaround issue with recursive 'JLayeredPane.remove' call on LaF switch on Linux To fix the issue, avoid calling `setContentPane` directly. Use a Wrapper panel. GitOrigin-RevId: 01a309da24650abcc91e5d129eb4fdccdb7ebe94 --- .../wm/impl/welcomeScreen/FlatWelcomeFrame.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java index 52d75326c75f..33285b4308b6 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java @@ -41,6 +41,7 @@ import com.intellij.ui.components.JBTextField; import com.intellij.ui.components.labels.ActionLink; import com.intellij.ui.components.panels.NonOpaquePanel; import com.intellij.ui.components.panels.VerticalLayout; +import com.intellij.ui.components.panels.Wrapper; import com.intellij.ui.mac.touchbar.Touchbar; import com.intellij.ui.mac.touchbar.TouchbarActionCustomizations; import com.intellij.ui.scale.JBUIScale; @@ -78,6 +79,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac public static final int DEFAULT_HEIGHT = USE_TABBED_WELCOME_SCREEN ? 650 : 460; public static final int MAX_DEFAULT_WIDTH = 800; private final AbstractWelcomeScreen myScreen; + private final Wrapper myContent; private WelcomeBalloonLayoutImpl myBalloonLayout; private boolean myDisposed; private DefaultFrameHeader myHeader; @@ -89,15 +91,18 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac myBalloonLayout = new WelcomeBalloonLayoutImpl(rootPane, JBUI.insets(8)); myScreen = USE_TABBED_WELCOME_SCREEN ? new TabbedWelcomeScreen() : new FlatWelcomeScreen(); + myContent = new Wrapper(); + setContentPane(myContent); + if (IdeFrameDecorator.isCustomDecorationActive()) { myHeader = new DefaultFrameHeader(this); - setContentPane(CustomFrameDialogContent.getCustomContentHolder(this, myScreen.getWelcomePanel(), myHeader)); + myContent.setContent(CustomFrameDialogContent.getCustomContentHolder(this, myScreen.getWelcomePanel(), myHeader)); } else { if (USE_TABBED_WELCOME_SCREEN && SystemInfoRt.isMac) { rootPane.setJMenuBar(new WelcomeFrameMenuBar().setFrame(this)); } - setContentPane(myScreen.getWelcomePanel()); + myContent.setContent(myScreen.getWelcomePanel()); } IdeGlassPaneImpl glassPane = new IdeGlassPaneImpl(rootPane); @@ -178,7 +183,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac if (USE_TABBED_WELCOME_SCREEN && SystemInfoRt.isMac) { rootPane.setJMenuBar(new WelcomeFrameMenuBar().setFrame(this)); } - setContentPane(myScreen.getWelcomePanel()); + myContent.setContent(myScreen.getWelcomePanel()); } if (USE_TABBED_WELCOME_SCREEN) { JBDimension defaultSize = JBUI.size(MAX_DEFAULT_WIDTH, defaultHeight);