From 735a0551b1425954b8d5b2ff2fa5bf72413c1a5b Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 18 Dec 2019 23:28:06 +0100 Subject: [PATCH] avoid circular inheritance when using blocks to set sprites' parents --- HISTORY.md | 2 ++ snap.html | 2 +- src/threads.js | 10 ++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 2e66b95e..2e0d6a58 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -12,6 +12,7 @@ * when creating a costume from pen trails (raster or vector) make its rotation center the position of the sprite * **Notable Fixes:** * support null-serialization in list-csv conversions + * avoid circular inheritance when using blocks to set sprites' parents * **Translation Updates:** * NEW Slovak translation, thanks, Peter Lukacovic * German @@ -19,6 +20,7 @@ ### 2019-12-18 * gui, api: rearranged Snap! API into its own file * added API documentation +* threads: avoid circular inheritance when using blocks to set sprites' parents ### 2019-12-16 * gui, objects: added ability to add general message listeners for "any" message diff --git a/snap.html b/snap.html index 22e8a34e..313bee79 100755 --- a/snap.html +++ b/snap.html @@ -7,7 +7,7 @@ - + diff --git a/src/threads.js b/src/threads.js index 07525935..0b2481bc 100644 --- a/src/threads.js +++ b/src/threads.js @@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, Color, TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/ -modules.threads = '2019-December-16'; +modules.threads = '2019-December-18'; var ThreadManager; var Process; @@ -4554,7 +4554,13 @@ Process.prototype.doSet = function (attribute, value) { case 'parent': this.assertType(rcvr, 'sprite'); value = value instanceof SpriteMorph ? value : null; - // needed: circularity avoidance + // avoid circularity + if (value instanceof SpriteMorph && + contains(value.allExemplars(), rcvr)) { + throw new Error( + localize('unable to inherit\n(disabled or circular?)') + ); + } rcvr.setExemplar(value); break; case 'temporary?':