No idea what I'm talking about but maybe.

There have been a few crashes in my mods in 1.9a1. Nothing that can easily be replicated and quite varied in the debug output.

Possibly it is changes in event error reporting code that is having some influence on causing the crashes.

Most of the crashes seem to involve an object. A ship object being Nil or incorrectly defined or something.

AP reports a repeatable crash with the Zyrran stations in TBR Crash with Zyrran stations.. This apparently involves the <OnDockObjAdj> event.

Changing the code in that event so it returns Nil rather than True as I think it currently does seems to fix the crash.

Based on very limited understanding of the code in CSpaceObject.cpp it appears the three outcomes for <OnDockObjAdj> are an error, Nil or an object.
Possibly a True value is considered an error (possibly anything not either an object or Nil is considered an error).
If this is the case then it could be that the error reporting code is involved in causing the crash. This error reporting code doesn't run for Nil or object returns in the event. I did not test the code to see what happens if an object is returned. EDIT: But the St Kats event seems to still be working.

If any of the other crashes that happen also run the same error reporting code this could indicate that the error code might be contributing in some way.

But my coding is definitely poor, so this could be a complete load of rubbish and please don't hurt yourself laughing if so! :)

EDIT: Both the Taipan and Commander's Log mod, where the errors are occuring, use minor actions to navigate between screens. I can't see how this would have any effect but who knows! A possible consideration as a lot of the errors seem to involve screens.
Further thoughts: When the playership is destroyed the "game end" code runs. This has priority over all other code. So if the playership is in a screen when it is destroyed it is automatically undocked and the screen exited. This doesn't happen for non-playership objects in dockscreens. Possibly there could be engine auto-code which force undocked a screen if the object it was using as a source was destroyed. There are probably a heap of occasions when this might not be a good idea but I'm not a developer, so I don't know!

assumedpseudonym 9 Aug 2019:

 That does fix my crash, at least.

george moromisato 4 Nov 2019:

In 1.9 Alpha 2 I've added some extra checks to validate pointers. This makes <OnDockObjAdj> more resilient in case the code returns anything other than an object pointer or an error.

But the root problem is that TLisp passes naked CSpaceObject pointers around. The real solution is to wrap CSpaceObject in a safe TLisp class. I've added this for the future: