summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2019-11-07 11:24:21 +0000
committerqsm-odoo <qsm@odoo.com>2019-11-07 12:10:59 +0000
commit60d1e26f9ae32f9feb61a0fa2135e0bcfed865fc (patch)
tree482d47d17b38729b8eb3b5d263eedd8d34bcc5ac /addons/web/static/src/js/core
parent7a18176c8682c459ee8a5f143f9f1264c33c80ef (diff)
[FIX] web: prevent destroyed widget from calling start (2)
This completes a commit that was made for the version saas-11.3 (12.0): https://github.com/odoo/odoo/commit/1440c8be0337c89e3d67d6d93e614c269c8689f1 Indeed, the logic was implemented for the appendTo, prependTo, etc methods but not for the attachTo... This could solve unknown problems in stable versions as well but was judged too risky to merge there. Indeed, if a real problem occurs in a stable version because of this, the condition can be added to the related widget individually. The problem was found in master: during website edition, the public widgets can be restarted if an element is edited... but sometimes the public widgets may be restarted in the same JS stack execution. The willStart method being async, the destroy method was called before the start method. This does not lead not any known problem with our current widgets but will create one for a new snippet being implemented. closes odoo/odoo#39949 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/core')
-rw-r--r--addons/web/static/src/js/core/widget.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/addons/web/static/src/js/core/widget.js b/addons/web/static/src/js/core/widget.js
index 441899e30db..c6530b7fb7a 100644
--- a/addons/web/static/src/js/core/widget.js
+++ b/addons/web/static/src/js/core/widget.js
@@ -204,6 +204,9 @@ var Widget = core.Class.extend(mixins.PropertiesMixin, ServicesMixin, {
var self = this;
this.setElement(target.$el || target);
return this.willStart().then(function () {
+ if (self.__parentedDestroyed) {
+ return;
+ }
return self.start();
});
},