Skip to content

Commit dc9dbc0

Browse files
committed
"Fixes" I'm particularly unhappy about
1 parent 33538ff commit dc9dbc0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Entities/MovableObject.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,13 @@ void MovableObject::DestroyScriptState() {
549549
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
550550

551551
void MovableObject::Destroy(bool notInherited) {
552+
// Unfortunately, shit can still get destroyed at random from Lua states having ownership and their GC deciding to delete it.
553+
// This skips the DestroyScriptState call... so there's leftover stale script state that we just can't do shit about.
554+
// This means Destroy() doesn't get called, and the lua memory shit leaks because it never gets set to nil. But oh well.
555+
// So.. we need to do this shit... I guess. Even though it's fucking awful. And it definitely results in possible deadlocks depending on how different lua states interact.
556+
// TODO: try to make this at least reasonably workable
557+
DestroyScriptState();
558+
552559
g_MovableMan.UnregisterObject(this);
553560
if (!notInherited) {
554561
SceneObject::Destroy();

0 commit comments

Comments
 (0)