GDExtension: Prevent crash during shutdown as singletons are deleted
This commit is contained in:
parent
2ba22d1554
commit
14506a4282
4 changed files with 17 additions and 4 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ public:
|
|||
bool notify_frame_server_synced();
|
||||
|
||||
Engine();
|
||||
virtual ~Engine() {}
|
||||
virtual ~Engine();
|
||||
};
|
||||
|
||||
#endif // ENGINE_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue