GDExtension: Prevent crash during shutdown as singletons are deleted

This commit is contained in:
David Snopek 2024-05-10 12:07:21 -05:00
parent 2ba22d1554
commit 14506a4282
4 changed files with 17 additions and 4 deletions

View file

@ -384,6 +384,12 @@ Engine::Engine() {
singleton = this;
}
Engine::~Engine() {
if (singleton == this) {
singleton = nullptr;
}
}
Engine::Singleton::Singleton(const StringName &p_name, Object *p_ptr, const StringName &p_class_name) :
name(p_name),
ptr(p_ptr),

View file

@ -187,7 +187,7 @@ public:
bool notify_frame_server_synced();
Engine();
virtual ~Engine() {}
virtual ~Engine();
};
#endif // ENGINE_H