I finally tracked this one down. It was causing
occasional crashes and weird effects, but only in
release builds, and it took a while to find.
In Action.h, one of the three constructors of
TimedAction does not initialize the member
variable "valid". This causes some Actions added to
the queue via Game::AddActionRelative() and
Game::AddActionAbsolute() -- among other code paths --
to occasionally drop Actions. These do not cause a
memory leak, but they can lead to commands being
ignored, breaks in combat, and, depending on how your
logics are set up, possibly to crashes.
To fix:
search in Action.h for the third and final
TimedAction constructor. It looks like this:
TimedAction(
BasicLib::sint64 time,
const std::string& p_action,
entityid p_data1 = 0,
entityid p_data2 = 0,
entityid p_data3 = 0,
entityid p_data4 = 0,
const std::string& p_data = "" ) :
executiontime( time ),
actionevent( p_action, p_data1, p_data2, p_data3,
p_data4, p_data ) {}
Make it also initialize the valid variable to true,
like this:
TimedAction(
BasicLib::sint64 time,
const std::string& p_action,
entityid p_data1 = 0,
entityid p_data2 = 0,
entityid p_data3 = 0,
entityid p_data4 = 0,
const std::string& p_data = "" ) :
executiontime( time ),
actionevent( p_action, p_data1, p_data2, p_data3,
p_data4, p_data ),
valid( true ) {}
Though this fix has helped reliability considerably,
I am not positive this is the source of all the
crashes in release mode. I'll add more bugs if I
track them down.
Logged In: YES
user_id=860892
Ah, now I CAN trace this back to the crashes. Because
these TimedAction *'s are AddHook()'ed into various
objects, but are then deleted without ever being unhooked,
they cause crashes whenever the object it was hooked into
loops over its hooks (such as in LogicEntity::KillHook()).
This is a serious error and I suspect it to be the cause
of much bizarre behavior. Yay for fix. Go me.