From ba5c403f7ac586d8e8393f7557d559c66dd36d99 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 21 May 2020 15:48:31 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-32068=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=BB=91=E5=B1=8F=EF=BC=8C=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=EF=BC=8C=E9=87=8D=E5=90=AF=E5=90=8E=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index a1f88d77ce..622e9a59cb 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -11,6 +11,7 @@ import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.general.FRFont; @@ -150,12 +151,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void on(PluginEvent event) { PluginContext context = event.getContext(); PluginRuntime runtime = context.getRuntime(); - Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); - for (PropertyItemPaneProvider provider : providers) { - addPropertyItem(provider); - } - updateAllPropertyPane(); - } + final Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + // UI相关的逻辑 用UI线程执行 不走FinePluginController线程 走FinePluginController线程有几率出问题 + // 容易导致FinePluginController持有Swing内部的java.awt.Component$AWTTreeLock 这个锁不能被UI线程之外的线程持有 否则容易造成UI线程被Blocked住 + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + for (PropertyItemPaneProvider provider : providers) { + addPropertyItem(provider); + } + updateAllPropertyPane(); + } + }); } }, filter); PluginListenerRegistration.getInstance().listen( PluginEventType.BeforeStop, @@ -164,12 +171,16 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void on(PluginEvent event) { PluginContext context = event.getContext(); PluginRuntime runtime = context.getRuntime(); - Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); - for (PropertyItemPaneProvider provider : providers) { - removePropertyItem(provider); - - } - updateAllPropertyPane(); + final Set providers = runtime.get(PropertyItemPaneProvider.XML_TAG); + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + for (PropertyItemPaneProvider provider : providers) { + removePropertyItem(provider); + } + updateAllPropertyPane(); + } + }); } }, filter); }