mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2026-05-07 00:10:18 -04:00
0da634d6e7
The scripting engine's `ExecutePluginCall` by default frees its `JSValue` arguments. When `HookEngine::Call` iterates over multiple subscribers, the first call would free the argument, leaving subsequent subscribers with an invalid pointer (use-after-free). This commit fixes the issue by duplicating the `JSValue` for each subscriber and ensuring the original value is correctly managed based on the `keepArgsAlive` flag. A new C++ headless test `ScriptingTests.cpp` is added to verify the fix and prevent future regressions.