Merge pull request #87635 from rune-scape/manage-time-singleton

Manage time singleton in `register_core_types`
This commit is contained in:
Rémi Verschelde
2024-02-12 13:34:13 +01:00
3 changed files with 3 additions and 11 deletions
-3
View File
@@ -189,9 +189,6 @@ static const uint8_t MONTH_DAYS_TABLE[2][12] = {
Time *Time::singleton = nullptr;
Time *Time::get_singleton() {
if (!singleton) {
memnew(Time);
}
return singleton;
}
+3
View File
@@ -102,6 +102,7 @@ static core_bind::Marshalls *_marshalls = nullptr;
static core_bind::EngineDebugger *_engine_debugger = nullptr;
static IP *ip = nullptr;
static Time *_time = nullptr;
static core_bind::Geometry2D *_geometry_2d = nullptr;
static core_bind::Geometry3D *_geometry_3d = nullptr;
@@ -128,6 +129,7 @@ void register_core_types() {
ObjectDB::setup();
StringName::setup();
_time = memnew(Time);
ResourceLoader::initialize();
register_global_constants();
@@ -436,6 +438,7 @@ void unregister_core_types() {
ResourceLoader::finalize();
ClassDB::cleanup_defaults();
memdelete(_time);
ObjectDB::cleanup();
Variant::unregister_types();