1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Clone default node properties to avoid reference leakage

This commit is contained in:
Nick O'Leary 2016-06-29 22:53:14 +01:00
parent 9d4d1acf2d
commit 8608d010b8
2 changed files with 4 additions and 2 deletions

View File

@ -773,7 +773,7 @@ RED.editor = (function() {
} }
for (var d in node_def.defaults) { for (var d in node_def.defaults) {
if (node_def.defaults[d].value) { if (node_def.defaults[d].value) {
editing_config_node[d] = node_def.defaults[d].value; editing_config_node[d] = JSON.parse(JSON.stringify(node_def.defaults[d].value));
} }
} }
editing_config_node["_"] = node_def._; editing_config_node["_"] = node_def._;

View File

@ -345,7 +345,9 @@ RED.view = (function() {
for (var d in nn._def.defaults) { for (var d in nn._def.defaults) {
if (nn._def.defaults.hasOwnProperty(d)) { if (nn._def.defaults.hasOwnProperty(d)) {
nn[d] = nn._def.defaults[d].value; if (nn._def.defaults[d].value !== undefined) {
nn[d] = JSON.parse(JSON.stringify(nn._def.defaults[d].value));
}
} }
} }