Dedmen — 22/11/2021
oof it indeeed crashed in script evaluator
Description
Details
- Severity
- None
- Resolution
- Open
- Reproducibility
- N/A
- Operating System
- Windows 10 x64
- Category
- General
- Subscribe to ADT mod - https://steamcommunity.com/sharedfiles/filedetails/?id=2369477168
- Start the game with only this mod loaded
- Create new empty mission in VR world
- Place any unit
- Start "Singleplayer"
- Save mission
- Load latest user save
- Observe game crash
Event Timeline
So I noticed that this crash occurs due to Arma saving some stuff that it shouldn't.
Maybe because I store displays into global variables, and it tries to deserialize those global vars.
The script code of the crashing script instruction is uiSleep 0.5; continue
I think it might be a problem in the continue command call.
You have this while loop
private _currentTab = (_window getVariable ["DBUG_currentTab", controlNull]); private _editorText = ctrlText _editor; private _currentPath = _currentTab getVariable ["DBUG_params", []] param [13, ""]; if (_editorText isEqualTo _lastEditorText) then {uiSleep 0.5; continue};
Now. Because you are loading from a saved game, the while loop script actually is not referencing a script file. Each item on the script callstack has been deserialized and is stand-alone, disconnected from the overall script file it once came from.
When deserializing, the scripts are stored as string, until they are called first time, then they are compiled.
Usually in a script you'd have for example a while scope, with a then scope inside it. The while has a referece to its script, the while script has a reference to the then and the then-script.
So the topmost callstack item always forms a reference chain to the bottom-most item, so while the topmost is in memory, the ones below it will never go away.
But, not when loaded from savegame where each piece (at the start) is deserialized by itself. The while contains the script below it, but only as a uncompiled string, and it doesn't have any references to the script that is in the next callstack item.
When continue walks up to the while, it cleans up everything below the while.
Now, because that script is standalone and not referenced anywhere else (the while script is actually not even compiled at this point), when we clean up the stack below the while, we are deleting the then-script. We are deleting the script that contains the instruction we are currently executing.