Browse Source

REPORT-32105 表单关闭后 JForm对象未释放 导致设计器最终发生oom

feature/big-screen
hades 5 years ago
parent
commit
6a6469cb35
  1. 32
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java

32
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -128,6 +128,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
//FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示
protected int index = FORM_TAB;
private PluginEventListener pluginListener;
public JForm() {
super(new Form(new WBorderLayout("form")), "Form");
@ -151,18 +153,18 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
return context.contain(PropertyItemPaneProvider.XML_TAG);
}
};
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun,
new PluginEventListener(PropertyItemPaneProvider.LAST) {
@Override
public void on(PluginEvent event) {
PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime();
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
}, filter);
this.pluginListener = new PluginEventListener(PropertyItemPaneProvider.LAST) {
@Override
public void on(PluginEvent event) {
PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime();
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
};
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener, filter);
}
private void initPluginPane() {
@ -1038,4 +1040,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
// richer:form文件 daniel 改成三个字
fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
}
@Override
public void whenClose() {
// stop的时候 pluginListener 和 PluginFilter 都会移除
PluginListenerRegistration.getInstance().stopListen(this.pluginListener);
}
}

Loading…
Cancel
Save