You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix#3119. Don't expose ListValue<T> lists to users (#3129)
* Fix#3119. Don't expose ListValue<T> lists to users
Use Collections.Generic.List<T> instead of ListValue<T>. Return a ListValue copy of these lists to user code.
Changes:
FileContent:binary
Lexicon:keys
Lexicon:values
Part:children
Stage:resources
Stage:resourceslex
String:split
Structure:suffixnames
Timewarp:ratelist
Timewarp:railsratelist
Timewarp:physicsratelist
Vessel:parts
Vessel:dockingports
Vessel:decouplers (separators)
Vessel:resources
allnodes bound variable
allwaypoints function
Stage:resources, Stage:resourceslex, Vessel:parts, Vessel:dockingports, Vessel:decouplers now return copies instead of references to internal lists. All lists returned by these suffixes don't get modified over time so the only way to tell that they are copies now is to use the equality operator. Stage:resources and Stage:resourceslex returning a reference was a bug.
* Optimize by not creating list copies where possible. Revert Vessel parts, dockingports, decouplers suffixes to return readonly references to internal lists
AddSuffix("HASPARENT",newSuffix<BooleanValue>(()=>Part.parent!=null,"Tells you if this part has a parent, is used to avoid null exception from PARENT"));
69
-
AddSuffix("CHILDREN",newSuffix<ListValue<PartValue>>(()=>PartValueFactory.ConstructGeneric(Part.children,Shared),"A LIST() of the children parts of this part"));
69
+
AddSuffix("CHILDREN",newSuffix<ListValue>(()=>PartValueFactory.ConstructGeneric(Part.children,Shared),"A LIST() of the children parts of this part"));
70
70
AddSuffix("DRYMASS",newSuffix<ScalarValue>(()=>Part.GetDryMass(),"The Part's mass when empty"));
71
71
AddSuffix("MASS",newSuffix<ScalarValue>(()=>Part.CalculateCurrentMass(),"The Part's current mass"));
72
72
AddSuffix("WETMASS",newSuffix<ScalarValue>(()=>Part.GetWetMass(),"The Part's mass when full"));
0 commit comments