ohmtal Posted March 28, 2023 Share Posted March 28, 2023 (edited) I found this in 3.10 but 4.x code looks the same so I guess it does not work there also. So I share my findings here: The (package) onExit scripts are not called and so the prefs are not saved. On Windows the Process::requestShutdown(); is called so the StandardMainLoop can finish and onExit is called. On Unix/Posix only _exit is executed and then onExit's in script's packages are never called. The solution is simple: I changed it to the way the windows platform code does it: in file x86UNIXProcessControl.cpp (3.10) or file POSIXProcessControl.cpp ( 4.current) add the include: #include "core/util/journal/process.h" and in Platform::postQuitMessage(const S32 in_quitVal) add the code at the beginning of the void: Process::requestShutdown(); return; Maybe in_quitVal should be handled if it's not 0 and forceShutdown(in_quitVal); should be called instead. Not validated so far. But on Windows Platform ignore the in_quitVal, also. Edited March 28, 2023 by ohmtal Quote Link to comment Share on other sites More sharing options...
JeffR Posted March 29, 2023 Share Posted March 29, 2023 Neat, thanks for the suggestion! I can give that a whirl to see if it behaves as expected on my linux machine and go from there. If you can, feel free to whip it up into a pull request on the repo. Quote Link to comment Share on other sites More sharing options...
JeffR Posted April 11, 2023 Share Posted April 11, 2023 Apologies for the delay in reply @ohmtal I gave it a shot, and so did practicing, and with your suggested change in neither case did we see onExit() or the module's onDestroy() get called on Linux. Is it possible there was another change you did somewhere that was also needed for the fix? Quote Link to comment Share on other sites More sharing options...
ohmtal Posted April 13, 2023 Author Share Posted April 13, 2023 Hello JeffR, I use the change successfully on a modified 3.10.1. Did not test it on 4 so far - only compared the source at POSIXProcessControl. Quote Link to comment Share on other sites More sharing options...
ohmtal Posted April 14, 2023 Author Share Posted April 14, 2023 (edited) I gave it a try on Linux. Compiled the current (4.x) sources. Added an echo to core.tscitpt onExit, started the binary and exit again. OnExit was not called. Then I added the changes, compiled and tried again. The onExit was not called but the prefs were exported. Double checked it and the prefs (onDestroy) are only exported when the changes are applied. I did not try to find out why the core.tscitpt's onExit is not called. Edited April 14, 2023 by ohmtal Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.