[pve-devel] [PATCH widget-toolkit 2/2] log/journal view: fix acces to me after destroying

Dominik Csapak d.csapak at proxmox.com
Mon Nov 21 08:53:42 CET 2022


it can happen that the view is destroyed during an api call,
so we should check if it's destroyed as the first thing in the
callback

if the view is destroyed, there is nothing we can do here, so simply
return

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/panel/JournalView.js | 3 +++
 src/panel/LogView.js     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/panel/JournalView.js b/src/panel/JournalView.js
index f3af36b..32c005a 100644
--- a/src/panel/JournalView.js
+++ b/src/panel/JournalView.js
@@ -143,6 +143,9 @@ Ext.define('Proxmox.panel.JournalView', {
 		waitMsgTarget: !livemode ? view : undefined,
 		method: 'GET',
 		success: function(response) {
+		    if (me.isDestroyed) {
+			return;
+		    }
 		    Proxmox.Utils.setErrorMask(me, false);
 		    let lines = response.result.data;
 		    me.updateView(lines, livemode, top);
diff --git a/src/panel/LogView.js b/src/panel/LogView.js
index dcbd002..44aa8e3 100644
--- a/src/panel/LogView.js
+++ b/src/panel/LogView.js
@@ -98,6 +98,9 @@ Ext.define('Proxmox.panel.LogView', {
 		params: viewModel.get('params'),
 		method: 'GET',
 		success: function(response) {
+		    if (me.isDestroyed) {
+			return;
+		    }
 		    Proxmox.Utils.setErrorMask(me, false);
 		    let total = response.result.total;
 		    let lines = [];
-- 
2.30.2






More information about the pve-devel mailing list