IDEMPIERE-5520 Navigation between Tabs leave Detached DOM objects (Leak) (#1671)

* IDEMPIERE-5520 Navigation between Tabs leave Detached DOM objects (Leak)

- Fix another "Not unique in the ID space of" when tab where clause have context variables and is navigated using zoom
- Add extra cleanup in the unexpected case a Find window is created again

* IDEMPIERE-5520 Navigation between Tabs leave Detached DOM objects (Leak)

- the delay removal using schedule is needed as immediate removal from parent will cause memory leak at browser

---------

Co-authored-by: hengsin <hengsin@gmail.com>
This commit is contained in:
Carlos Ruiz 2023-02-13 14:52:00 +01:00 committed by GitHub
parent 16c727017d
commit 17f1957d70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -4332,6 +4332,15 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (findWindow != null && isCurrentFindWindowValid()) { if (findWindow != null && isCurrentFindWindowValid()) {
toolbar.setSelectedUserQuery(findWindow.getAD_UserQuery_ID()); toolbar.setSelectedUserQuery(findWindow.getAD_UserQuery_ID());
} else { } else {
if (findWindow != null) {
//reset to no/auto id
FindWindow old = findWindow;
old.setId("");
if (old.getDesktop() != null) {
AEnv.detachInputElement(old);
Executions.schedule(old.getDesktop(), e -> old.detach(), new Event("onDetachOldFindWindow"));
}
}
findWindow = new FindWindow (adTabbox.getSelectedGridTab().getWindowNo(), adTabbox.getSelectedGridTab().getTabNo(), adTabbox.getSelectedGridTab().getName(), findWindow = new FindWindow (adTabbox.getSelectedGridTab().getWindowNo(), adTabbox.getSelectedGridTab().getTabNo(), adTabbox.getSelectedGridTab().getName(),
adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getTableName(), adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getTableName(),
adTabbox.getSelectedGridTab().getWhereExtended(), findFields, 1, adTabbox.getSelectedGridTab().getAD_Tab_ID(), this); adTabbox.getSelectedGridTab().getWhereExtended(), findFields, 1, adTabbox.getSelectedGridTab().getAD_Tab_ID(), this);

View File

@ -389,7 +389,10 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
if ((title == null && m_title != null) || (title != null && m_title == null) || !(title.equals(m_title))) return false; if ((title == null && m_title != null) || (title != null && m_title == null) || !(title.equals(m_title))) return false;
if (AD_Table_ID != m_AD_Table_ID) return false; if (AD_Table_ID != m_AD_Table_ID) return false;
if ((tableName == null && m_tableName != null) || (tableName != null && m_tableName == null) || !(tableName.equals(m_tableName))) return false; if ((tableName == null && m_tableName != null) || (tableName != null && m_tableName == null) || !(tableName.equals(m_tableName))) return false;
whereExtended = Env.parseContext(Env.getCtx(), targetWindowNo, whereExtended, false); if (whereExtended.contains("@"))
whereExtended = Env.parseContext(Env.getCtx(), targetWindowNo, whereExtended, false);
if (m_whereExtended.contains("@"))
m_whereExtended = Env.parseContext(Env.getCtx(), targetWindowNo, whereExtended, false);
if ((whereExtended == null && m_whereExtended != null) || (whereExtended != null && m_whereExtended == null) || !(whereExtended.equals(m_whereExtended))) return false; if ((whereExtended == null && m_whereExtended != null) || (whereExtended != null && m_whereExtended == null) || !(whereExtended.equals(m_whereExtended))) return false;
if (adTabId != m_AD_Tab_ID) return false; if (adTabId != m_AD_Tab_ID) return false;
if ((findFields == null && m_findFields != null) || (findFields != null && m_findFields == null) || (findFields.length != m_findFields.length)) return false; if ((findFields == null && m_findFields != null) || (findFields != null && m_findFields == null) || (findFields.length != m_findFields.length)) return false;