From 73f30a94b1341a8ec23d5ad68ee28134282cbaf4 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 20 Feb 2025 17:27:25 -0700 Subject: [PATCH] Some more memory cleanup --- .../etemplate/et2_extension_nextmatch_actions.js | 2 +- .../et2_extension_nextmatch_rowProvider.ts | 1 + api/js/framework/fw_classes.js | 1 + api/js/jsapi/egw.js | 16 ++++++++++++++++ api/js/jsapi/egw_tooltip.js | 13 +++++++------ 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/api/js/etemplate/et2_extension_nextmatch_actions.js b/api/js/etemplate/et2_extension_nextmatch_actions.js index 117f6859d0..8d1a565726 100644 --- a/api/js/etemplate/et2_extension_nextmatch_actions.js +++ b/api/js/etemplate/et2_extension_nextmatch_actions.js @@ -576,5 +576,5 @@ window.nm_hide_popup = function(element, div_id) */ window.nm_activate_link = function(_action, _senders) { - jQuery(_senders[0].iface.getDOMNode()).find('.et2_clickable:first').trigger('click'); + _senders[0].iface.getDOMNode().querySelector('.et2_clickable').dispatchEvent(new Event('click')); } diff --git a/api/js/etemplate/et2_extension_nextmatch_rowProvider.ts b/api/js/etemplate/et2_extension_nextmatch_rowProvider.ts index e325665c84..b8bce4fc4b 100644 --- a/api/js/etemplate/et2_extension_nextmatch_rowProvider.ts +++ b/api/js/etemplate/et2_extension_nextmatch_rowProvider.ts @@ -65,6 +65,7 @@ export class et2_nextmatch_rowProvider this._subgridCallback = null; this._context = null; this._rootWidget = null; + this._template.seperated = null; this._template = null; this._dataRow = null; } diff --git a/api/js/framework/fw_classes.js b/api/js/framework/fw_classes.js index cd747a5bb0..dcc8398397 100644 --- a/api/js/framework/fw_classes.js +++ b/api/js/framework/fw_classes.js @@ -62,6 +62,7 @@ if (this.sidemenuEntry) this.sidemenuEntry.remove(); delete this.sidemenuEntry; delete this.browser; + delete this.parentFw; delete (framework.applications[this.appName]); }; diff --git a/api/js/jsapi/egw.js b/api/js/jsapi/egw.js index dcd13318ab..27868fbbd7 100644 --- a/api/js/jsapi/egw.js +++ b/api/js/jsapi/egw.js @@ -174,6 +174,22 @@ window.app = {classes: {}}; window.egw.top = window; } + // Register unload listener for cleanup + if (popup) + { + // Uncomment this to debug pagehide events + // window.onpagehide = (e) => { debugger;}; + window.addEventListener("pagehide", (e) => + { + if (window.framework) + { + window.framework.popup_close(window); + } + window.framework = null; + window.egw = null; + }) + } + // focus window / call window.focus(), if data-window-focus is specified var window_focus = egw_script.getAttribute('data-window-focus'); if (window_focus && JSON.parse(window_focus)) diff --git a/api/js/jsapi/egw_tooltip.js b/api/js/jsapi/egw_tooltip.js index 261f8fa4fa..a871149877 100644 --- a/api/js/jsapi/egw_tooltip.js +++ b/api/js/jsapi/egw_tooltip.js @@ -26,22 +26,23 @@ egw.extend('tooltip', egw.MODULE_WND_LOCAL, function(_app, _wnd) "use strict"; const tooltipped = []; - _wnd.addEventListener("unload", (e) => + let tooltip_div = null; + let current_elem = null; + _wnd.addEventListener("pagehide", () => { tooltipped.forEach(node => { egw.tooltipUnbind(node); }); tooltipped.splice(0, tooltipped.length); - if (tooltip_div && tooltipped_div.off) + if (tooltip_div && tooltip_div.off) { - tooltipped_div.off(); + tooltip_div.off(); + tooltip_div = null; } return null; }) - let tooltip_div = null; - let current_elem = null; const time_delta = 100; let show_delta = 0; @@ -152,7 +153,7 @@ egw.extend('tooltip', egw.MODULE_WND_LOCAL, function(_app, _wnd) jQuery(_wnd.document.body).append(tooltip_div); //The tooltip should automatically hide when the mouse comes over it - tooltip_div.on("mouseenter.tooltip", function () + tooltip_div.get(0).addEventListener("mouseover", () => { if (_options.hideonhover) hide(); });