[pve-devel] [PATCH manager 3/7] ext6migrate: fix store load race condition

Dominik Csapak d.csapak at proxmox.com
Fri Mar 11 15:57:30 CET 2016


when we click on a node/container/vm and quickly
click on something else, there might be a race condition,
where the store finished loading and we try to change
dom elements, which are not there anymore

the same in the logview panel

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/lxc/Config.js    | 3 +++
 www/manager6/node/Config.js   | 3 +++
 www/manager6/panel/LogView.js | 4 ++++
 www/manager6/qemu/Config.js   | 3 +++
 4 files changed, 13 insertions(+)

diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
index 8902c86..da90323 100644
--- a/www/manager6/lxc/Config.js
+++ b/www/manager6/lxc/Config.js
@@ -208,6 +208,9 @@ Ext.define('PVE.lxc.Config', {
 	me.callParent();
 
 	me.statusStore.on('load', function(s, records, success) {
+	    if (me.destroyed) { // return if the component is destroyed
+		return;
+	    }
 	    var status;
 	    if (!success) {
 		me.workspace.checkVmMigration(me.pveSelNode);
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index 10d8e44..1b223d4 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -218,6 +218,9 @@ Ext.define('PVE.node.Config', {
 	me.callParent();
 
 	me.statusStore.on('load', function(s, records, success) {
+	    if (me.destroyed) { // return if component is destroyed
+		return;
+	    }
 	    var uptimerec = s.data.get('uptime');
 	    var powermgmt = uptimerec ? uptimerec.data.value : false;
 	    if (!caps.nodes['Sys.PowerMgmt']) {
diff --git a/www/manager6/panel/LogView.js b/www/manager6/panel/LogView.js
index 9ed1213..825d7a2 100644
--- a/www/manager6/panel/LogView.js
+++ b/www/manager6/panel/LogView.js
@@ -41,6 +41,10 @@ Ext.define('PVE.panel.LogView', {
         var me = this;
 	var el = me.dataCmp.el;
 
+	if (me.destroyed) { // return if element is not there anymore
+	    return;
+	}
+
 	if (me.viewInfo && me.viewInfo.start === start &&
 	    me.viewInfo.end === end && me.viewInfo.total === total &&
 	    me.viewInfo.textLength === text.length) {
diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index 0e21767..fa574c4 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -219,6 +219,9 @@ Ext.define('PVE.qemu.Config', {
 	me.callParent();
 
         me.statusStore.on('load', function(s, records, success) {
+	    if (me.destroyed) { // return if component is destroyed
+		return;
+	    }
 	    var status;
 	    var qmpstatus;
 	    var spice = false;
-- 
2.1.4





More information about the pve-devel mailing list