diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-01-10 12:45:57 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-01-10 12:45:57 +0100 |
commit | e5f1d19352dbaafab96538b91fad0ce11cf0d046 (patch) | |
tree | c3cf72310e91ced0bd739b61d1d3197df78c1313 /core | |
parent | 940a2c5ec3e13d57c6462b7070eb3101766c91db (diff) | |
download | redot-engine-e5f1d19352dbaafab96538b91fad0ce11cf0d046.tar.gz |
Consistency in resource format saver/loader de-registration
Some used 'is_valid()' checks, others not. Validity is already checked in 'unref()',
and 'remove_resource_format_*()' has an ERR_FAIL condition on 'is_null()' already
(which shouldn't happen since we're only unregistering things that we previously
registered.
Also add missing GDCLASS statement in ResourceFormatLoaderVideoStreamGDNative,
missed in #20552 which was last amended before #19501 was merged.
Diffstat (limited to 'core')
-rw-r--r-- | core/register_core_types.cpp | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 68e293ba13..666384b093 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -68,8 +68,8 @@ static Ref<ResourceFormatSaverBinary> resource_saver_binary; static Ref<ResourceFormatLoaderBinary> resource_loader_binary; static Ref<ResourceFormatImporter> resource_format_importer; - static Ref<ResourceFormatLoaderImage> resource_format_image; +static Ref<TranslationLoaderPO> resource_format_po; static _ResourceLoader *_resource_loader = NULL; static _ResourceSaver *_resource_saver = NULL; @@ -77,7 +77,6 @@ static _OS *_os = NULL; static _Engine *_engine = NULL; static _ClassDB *_classdb = NULL; static _Marshalls *_marshalls = NULL; -static Ref<TranslationLoaderPO> resource_format_po; static _JSON *_json = NULL; static IP *ip = NULL; @@ -251,25 +250,17 @@ void unregister_core_types() { memdelete(_geometry); - if (resource_format_image.is_valid()) { - ResourceLoader::remove_resource_format_loader(resource_format_image); - resource_format_image.unref(); - } - - if (resource_saver_binary.is_valid()) { - ResourceSaver::remove_resource_format_saver(resource_saver_binary); - resource_saver_binary.unref(); - } - - if (resource_loader_binary.is_valid()) { - ResourceLoader::remove_resource_format_loader(resource_loader_binary); - resource_loader_binary.unref(); - } - - if (resource_format_importer.is_valid()) { - ResourceLoader::remove_resource_format_loader(resource_format_importer); - resource_format_importer.unref(); - } + ResourceLoader::remove_resource_format_loader(resource_format_image); + resource_format_image.unref(); + + ResourceSaver::remove_resource_format_saver(resource_saver_binary); + resource_saver_binary.unref(); + + ResourceLoader::remove_resource_format_loader(resource_loader_binary); + resource_loader_binary.unref(); + + ResourceLoader::remove_resource_format_loader(resource_format_importer); + resource_format_importer.unref(); ResourceLoader::remove_resource_format_loader(resource_format_po); resource_format_po.unref(); |