Closed cllunsford closed 9 months ago
Reproduced with Gig Performer 4.5.8 and mobius v2.5.1-rc.1
Simple script:
!name Test
Message This is before the reset!
Reset
Message This is after the reset!
If you start Record on track and run script, the track will reset, but the last Message will not be shown. If you remove the Reset then the last message will be shown.
In standalone Mobius, the same script will reset the track and display the "after reset" message.
Grabbed debug output from plugin while the script was executing. Key section:
00000184 58.45568466 [22620] 0 0: Mobius: runScript Test
00000185 58.45578766 [22620] 0 0: Mobius: Starting script thread
00000186 58.45584106 [22620] 0 0: Script 1:Test: message This is before the reset!
00000187 58.45593643 [22620] 0 0: Script 1:Test: Reset
00000188 58.45598602 [22620] 101 134880: Function Reset down
00000189 58.45608902 [22620] 0 0: Mobius: Script thread 1:Test: canceling
00000190 58.45614243 [22620] ERROR: 0 0: Script: Script was reset during execution!
00000191 58.45623016 [22620] 0 0: Mobius: Script thread 1:Test: ending
Compare to debug output on Standalone Mobius when script executes as expected
00000132 8.42098045 [39500] 0 0: Mobius: runScript Test
00000133 8.42117405 [39500] 0 0: Mobius: Starting script thread
00000134 8.42131805 [39500] 101 98417: Function Reset down
00000135 8.42147160 [39500] 0 0: Mobius: Script thread 1:Test: ending
Reviewing source, it looks like the default behavior when a Reset is executed is to cancel all scripts running in the track. A check is made to preserve the script if it's found to be the one that performed the reset (the situation we're encountering here). Need to determine why Mobius is not recognizing the ScriptInterpreter for the script in GP.
Found the cause of the issue: Action->id is being set as ScriptInterpreter pointer, but truncated to long
. This meant that the status check of ScriptInterpreter->id and SourceAction->id no longer matched (action->id was only 32-bits of the full pointer). Replacing Action->id with uintptr_t resolves the issue.