From b8d48ebabead89779a978a0c3c71b62aa8095c54 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Sat, 26 Mar 2016 19:37:12 -0700 Subject: [PATCH] Destroy attached shadow block when input is destroyed. --- core/block.js | 11 +++++++++-- core/block_svg.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/block.js b/core/block.js index 09fde8a27..3c2268fa9 100644 --- a/core/block.js +++ b/core/block.js @@ -1232,8 +1232,15 @@ Blockly.Block.prototype.removeInput = function(name, opt_quiet) { for (var i = 0, input; input = this.inputList[i]; i++) { if (input.name == name) { if (input.connection && input.connection.targetConnection) { - // Disconnect any attached block. - input.connection.targetBlock().unplug(); + input.connection.setShadowDom(null); + var block = input.connection.targetBlock(); + if (block.isShadow()) { + // Destroy any attached shadow block. + block.dispose(); + } else { + // Disconnect any attached normal block. + block.unplug(); + } } input.dispose(); this.inputList.splice(i, 1); diff --git a/core/block_svg.js b/core/block_svg.js index fd71732c8..04d59cc5d 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -499,7 +499,7 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) { // Right-click. this.showContextMenu_(e); } else if (!this.isMovable()) { - // Allow unmovable blocks to be selected and context menued, but not + // Allow immovable blocks to be selected and context menued, but not // dragged. Let this event bubble up to document, so the workspace may be // dragged instead. return;