From 9896a75caf2b10078be84069f0dc4ea062884a3f Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 1 Mar 2021 12:22:43 +0100 Subject: [PATCH] ui: tape/ChangerStatus: handle vanishing view during reload since reload is an async function, the view can be destroyed during any 'await' point. Subsequent accesses to the view will fail, and we will land in the catch. Check there if the view is destroyed, and do not raise an error with the user then also cancel any outstanding timer on 'deactivate' and 'destroy' Signed-off-by: Dominik Csapak --- www/tape/ChangerStatus.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/www/tape/ChangerStatus.js b/www/tape/ChangerStatus.js index dab34038..04422936 100644 --- a/www/tape/ChangerStatus.js +++ b/www/tape/ChangerStatus.js @@ -285,12 +285,17 @@ Ext.define('PBS.TapeManagement.ChangerStatus', { } }, - reload: function() { + cancelReload: function() { let me = this; if (me.reloadTimeout !== undefined) { clearTimeout(me.reloadTimeout); me.reloadTimeout = undefined; } + }, + + reload: function() { + let me = this; + me.cancelReload(); me.reload_full(true); }, @@ -398,6 +403,10 @@ Ext.define('PBS.TapeManagement.ChangerStatus', { } Proxmox.Utils.setErrorMask(me.lookup('content')); } catch (err) { + if (!view || view.isDestroyed) { + return; + } + if (!use_cache) { Proxmox.Utils.setErrorMask(view); } @@ -470,11 +479,13 @@ Ext.define('PBS.TapeManagement.ChangerStatus', { } view.title = `${gettext("Changer")}: ${view.changer}`; + me.reload(); }, }, listeners: { - activate: 'reload', + deactivate: 'cancelReload', + destroy: 'cancelReload', }, tbar: [