summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core/widget.js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2018-04-12 11:16:30 +0200
committerGéry Debongnie <ged@odoo.com>2018-04-12 12:11:55 +0200
commit1440c8be0337c89e3d67d6d93e614c269c8689f1 (patch)
treed2d8e06b04f3a7b981e201f811f7fc2c5e5c38bb /addons/web/static/src/js/core/widget.js
parent5dbb2fc834d9632272e5213ebe081752ff3817e9 (diff)
[FIX] web: prevent destroyed widget from calling start
Whenever a widget is destroyed, it should be as inactive as possible. Before this commit, it could happen that a widget was destroyed after the willstart method, but before the start method. In that case, bad things could happen. For example, the discuss client action tries to look up some information into the session, with the getSession method. This causes a crash whenever the widget is destroyed.
Diffstat (limited to 'addons/web/static/src/js/core/widget.js')
-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 5e23c3f2c47..b25cd99587b 100644
--- a/addons/web/static/src/js/core/widget.js
+++ b/addons/web/static/src/js/core/widget.js
@@ -391,6 +391,9 @@ var Widget = core.Class.extend(mixins.PropertiesMixin, ServicesMixin, {
_widgetRenderAndInsert: function (insertion, target) {
var self = this;
return this.willStart().then(function () {
+ if (self.__parentedDestroyed) {
+ return;
+ }
self.renderElement();
insertion(target);
return self.start();