Closed curiousdannii-testing closed 2 years ago
557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:
Comment by DavidG :
>recording on
[Command recording on.]>take feather
Taken.>recording off
[Command recording off.]>replay
[Replaying commands.]>take feather
You already have that.>recording off
[Command replay complete.]>undo
Beautiful Garden
[Previous turn undone.]>
--------------------------------------------------------------------------------
Glulxe fatal error: Reference to nonexistent Glk object.Hit any key to exit.
557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:
Comment by DavidG :
Cross reported to https://gitlab.com/DavidGriffith/inform6lib/issues/55
Reported by : turthalion
Description :
Compiled using Inform v6.33 Library v6.12.1 S).
After I replay a command script, even one of only one command, issuing "undo" causes Git and Glulxe report:
Reference to non-existent Glk object
Lectrote is, as expected more helpful, showing:
Quixe run: glk_get_line_stream: invalid stream
If, without replaying, I take the same command, I can type it in, hit and then type 'undo' and nothing untoward happens.
I've got a minimal example (attached) that demonstrates this.
If it is compiled with -~D in any way, then it crashes when you type undo after inputting a replay file.
in parserm.h in GGRecoverObjects (line 6491 in mine), there's the following:
#Ifdef DEBUG;
gg_commandstr = 0;
gg_command_reading = false;
#Endif; ! DEBUG
and a bit further down inside the switch sstatement (line 6503):
#Ifdef DEBUG;
GG_COMMANDWSTR_ROCK: gg_commandstr = id;
gg_command_reading = false;
GG_COMMANDRSTR_ROCK: gg_commandstr = id;
gg_command_reading = true;
#Endif; ! DEBUG
So we only wipe gg_commandstr and clear gg_command_reading when it's a debug build (which, unsurprisingly, is when it works properly for me, not crashing). If it's a release build, gg_commandstr is not cleared.
During discussion at intfiction.org (thread: https://www.intfiction.org/forum/viewtopic.php?f=7&t=25197&p=138447), zarf had the following to say:
"I don't know why the gg_commandstr lines in GGRecoverObjects() are conditionalized with "#ifdef DEBUG". There's no good reason for that, except maybe the expectation that the RECORD command will only be used on debug builds, which is not a good assumption. You can just remove the "#ifdef" lines there."
So I thought I'd post this here and see if anyone knows of a reason those #Ifdefs are there. I can verify that removing both sets seems to address my issue.
Steps to reproduce :
Additional information :
The interpreter will crash.
imported from: [Mantis 2046] "undo" after replay input crashes Glulx interpreter