Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
"Fixes" I'm particularly unhappy about
Browse files Browse the repository at this point in the history
  • Loading branch information
Causeless committed Dec 23, 2023
1 parent 33538ff commit dc9dbc0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Entities/MovableObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,13 @@ void MovableObject::DestroyScriptState() {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void MovableObject::Destroy(bool notInherited) {
// Unfortunately, shit can still get destroyed at random from Lua states having ownership and their GC deciding to delete it.
// This skips the DestroyScriptState call... so there's leftover stale script state that we just can't do shit about.
// This means Destroy() doesn't get called, and the lua memory shit leaks because it never gets set to nil. But oh well.
// 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.
// TODO: try to make this at least reasonably workable
DestroyScriptState();

g_MovableMan.UnregisterObject(this);
if (!notInherited) {
SceneObject::Destroy();
Expand Down

0 comments on commit dc9dbc0

Please sign in to comment.