IDEMPIERE-5686 - Closing Browser Tab while Process Modal Dialog is Opened causes NPE (#1797)

* IDEMPIERE-5686 - Closing Browser Tab while Process Modal Dialog is Opened causes NPE

* IDEMPIERE-5686 - fixes

* IDEMPIERE-5650 - WProcessCtl fix

* IDEMPIERE-5650 - move check to ShowMaskWrapper
This commit is contained in:
Peter Takács 2023-04-25 10:23:02 +02:00 committed by GitHub
parent 86a91987e1
commit 4a35720457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -18,6 +18,7 @@ import org.adempiere.webui.component.Mask;
import org.adempiere.webui.part.UIPart;
import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.util.Clients;
/**
@ -113,7 +114,8 @@ public class ShowMaskWrapper implements ISupportMask {
* @param comp
*/
public static void setFlagShowMask (Component comp){
comp.setAttribute(ISupportMask.READY_SHOW_MASK_FLAG, Integer.valueOf(1), Component.REQUEST_SCOPE);
if(Executions.getCurrent() != null && Executions.getCurrent().getNativeRequest() != null)
comp.setAttribute(ISupportMask.READY_SHOW_MASK_FLAG, Integer.valueOf(1), Component.REQUEST_SCOPE);
}
/**
@ -122,6 +124,7 @@ public class ShowMaskWrapper implements ISupportMask {
* @return true if flag exists
*/
public static boolean hasFlagShowMask (Component comp){
return (comp.getAttribute(ISupportMask.READY_SHOW_MASK_FLAG, Component.REQUEST_SCOPE) != null);
return (Executions.getCurrent() != null && Executions.getCurrent().getNativeRequest() != null)
&& (comp.getAttribute(ISupportMask.READY_SHOW_MASK_FLAG, Component.REQUEST_SCOPE) != null);
}
}

View File

@ -2443,6 +2443,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
createT_Selection_InfoWindow(pInstanceID);
recordSelectedData.clear();
}else if (ProcessModalDialog.ON_WINDOW_CLOSE.equals(event.getName())){
if (getDesktop() == null)
return;
if (processModalDialog.isCancel()){
//clear back
m_results.clear();