OpenClonk Bugtracker - OpenClonk
View Issue Details
0001798OpenClonkEngine - C4Scriptpublic2016-07-23 14:552016-08-27 06:04
ReporterSven2 
Assigned ToSven2 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformVisual C++ 2008OSWindowsOS Version 
Product Version 
Target VersionFixed in Versiongit master 
Summary0001798: Saving references to dynamic proplists created in Definition()
DescriptionWhen proplists (or arrays?) are assigned in Definition(), they are still dynamic proplists and will be saved as such in savegames. When such a savegame is resumed, the proplist is re-created as a copy and the reference is lost. E.g. consider this object script:

''func Definition(def) { def.bar = {}; };
func Initialize() { this.foo = this.bar; AddTimer(this.Timer); }
func Timer() { Log("%v", this.foo == this.bar); }''

This will log "true" in the timer, but will switch to "false" when a savegame is resumed.

This is problematic because editor-made sequences in the new qteditor use this exact same paradigm to store and resume progress in sequences.

My proposed solution would be to iterate over the whole proplist+array tree in all definitions after the Definition() calls, freeze them and assign static names (i.e.: Convert them to static proplists+arrays).
TagsNo tags attached.
Attached Files

Notes
(0005208)
Sven2   
2016-07-25 03:53   
Note that if this bug is fixed, default value assignment in enum delegates needs to be changed to do a deep copy. It currently relies on Format("%v", foo) creating a non-frozen copy, which would no longer work if proplists created in Definition() were static.

Issue History
2016-07-23 14:55Sven2New Issue
2016-07-23 14:55Sven2SummarySaving references to dynamic proplists containing names => Saving references to dynamic proplists created in Definition()
2016-07-25 03:53Sven2Note Added: 0005208
2016-08-27 05:12Sven2Assigned To => Sven2
2016-08-27 05:12Sven2Statusnew => assigned
2016-08-27 06:04Sven2Statusassigned => resolved
2016-08-27 06:04Sven2Resolutionopen => fixed
2016-08-27 06:04Sven2Fixed in Version => git master