Fixed bubble dispose (#3430)

* Fixed bubble dispose.
This commit is contained in:
Beka Westberg
2019-11-12 10:15:16 -08:00
committed by Sam El-Husseini
parent dad8738e75
commit e6e63f456b

View File

@@ -79,6 +79,14 @@ Blockly.Bubble = function(workspace, content, shape, anchorXY,
*/
this.onMouseDownResizeWrapper_ = null;
/**
* Describes whether this bubble has been disposed of (nodes and event
* listeners removed from the page) or not.
* @type {boolean}
* @package
*/
this.disposed = false;
var angle = Blockly.Bubble.ARROW_ANGLE;
if (this.workspace_.RTL) {
angle = -angle;
@@ -796,24 +804,15 @@ Blockly.Bubble.prototype.setColour = function(hexColour) {
* Dispose of this bubble.
*/
Blockly.Bubble.prototype.dispose = function() {
Blockly.Bubble.unbindDragEvents_();
// Dispose of and unlink the bubble.
Blockly.utils.dom.removeNode(this.bubbleGroup_);
if (this.onMouseDownBubbleWrapper_) {
Blockly.unbindEvent_(this.onMouseDownBubbleWrapper_);
this.onMouseDownBubbleWrapper_ = null;
}
if (this.onMouseDownResizeWrapper_) {
Blockly.unbindEvent_(this.onMouseDownResizeWrapper_);
this.onMouseDownResizeWrapper_ = null;
}
this.bubbleGroup_ = null;
this.bubbleArrow_ = null;
this.bubbleBack_ = null;
this.resizeGroup_ = null;
this.workspace_ = null;
this.content_ = null;
this.shape_ = null;
Blockly.Bubble.unbindDragEvents_();
Blockly.utils.dom.removeNode(this.bubbleGroup_);
this.disposed = true;
};
/**