Framework: Add some additional calls to popups_garbage_collector() to make sure popups don't hang around.

This commit is contained in:
nathan 2025-03-05 10:04:02 -07:00
parent 7ef2e53dd3
commit 46ecd54711
2 changed files with 17 additions and 2 deletions

View File

@ -945,6 +945,7 @@ window.fw_base = (function(){ "use strict"; return Class.extend(
windowID.framework = this; windowID.framework = this;
this.popups.push(windowID); this.popups.push(windowID);
this.popups_garbage_collector();
if (navigate) if (navigate)
{ {
@ -995,7 +996,8 @@ window.fw_base = (function(){ "use strict"; return Class.extend(
*/ */
popups_garbage_collector: function () popups_garbage_collector: function ()
{ {
for (var i=0; i < this.popups.length; i++) let i = this.popups.length;
while (i--)
{ {
if (this.popups[i].closed) this.popups.splice(i,1); if (this.popups[i].closed) this.popups.splice(i,1);
} }

View File

@ -105,12 +105,14 @@ export class EgwFramework extends LitElement
// Keep track of open popups // Keep track of open popups
private _popups : Window[] = []; private _popups : Window[] = [];
private _popupsGCInterval : number;
// Keep track of open messages // Keep track of open messages
private _messages : SlAlert[] = []; private _messages : SlAlert[] = [];
private get tabs() : SlTabGroup { return this.shadowRoot.querySelector("sl-tab-group");} private get tabs() : SlTabGroup { return this.shadowRoot.querySelector("sl-tab-group");}
constructor() constructor()
{ {
super(); super();
@ -459,6 +461,11 @@ export class EgwFramework extends LitElement
windowID.framework = this; windowID.framework = this;
this._popups.push(windowID); this._popups.push(windowID);
if(!this._popupsGCInterval)
{
// Check every 60s to make sure we didn't miss any
window.setInterval(() => this.popups_garbage_collector, 60000);
}
if(_returnID !== false) if(_returnID !== false)
{ {
@ -472,13 +479,19 @@ export class EgwFramework extends LitElement
*/ */
public popups_garbage_collector() public popups_garbage_collector()
{ {
for(var i = 0; i < this._popups.length; i++) let i = this._popups.length;
while(i--)
{ {
if(this._popups[i].closed) if(this._popups[i].closed)
{ {
this._popups.splice(i, 1); this._popups.splice(i, 1);
} }
} }
if(this._popups.length == 0 && this._popupsGCInterval)
{
window.clearInterval(this._popupsGCInterval);
this._popupsGCInterval = null;
}
} }
/** /**