diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-01-10 14:25:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-10 14:25:09 +0100 |
commit | 899ad484e37f1f0544bd7c93c560f6a0ca980d5d (patch) | |
tree | b19f5e12a8b8319d0ce5c76d7d3de7afe9383ea7 | |
parent | 5bf8bdc97187aa17103e418b1e08a96d1681f211 (diff) | |
parent | e5f1d19352dbaafab96538b91fad0ce11cf0d046 (diff) |
Merge pull request #24883 from akien-mga/resourceformat-unregister
Consistency in resource format saver/loader de-registration
-rw-r--r-- | core/register_core_types.cpp | 33 | ||||
-rw-r--r-- | drivers/register_driver_types.cpp | 6 | ||||
-rw-r--r-- | modules/gdnative/register_types.cpp | 8 | ||||
-rw-r--r-- | modules/gdnative/videodecoder/video_stream_gdnative.h | 1 | ||||
-rw-r--r-- | modules/gdscript/register_types.cpp | 12 | ||||
-rw-r--r-- | modules/mono/register_types.cpp | 14 | ||||
-rw-r--r-- | modules/theora/register_types.cpp | 5 | ||||
-rw-r--r-- | modules/webm/register_types.cpp | 5 | ||||
-rw-r--r-- | scene/register_scene_types.cpp | 33 |
9 files changed, 43 insertions, 74 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(); diff --git a/drivers/register_driver_types.cpp b/drivers/register_driver_types.cpp index e9e49203ea..20556d98af 100644 --- a/drivers/register_driver_types.cpp +++ b/drivers/register_driver_types.cpp @@ -59,10 +59,8 @@ void unregister_core_driver_types() { if (image_loader_png) memdelete(image_loader_png); - if (resource_saver_png.is_valid()) { - ResourceSaver::remove_resource_format_saver(resource_saver_png); - resource_saver_png.unref(); - } + ResourceSaver::remove_resource_format_saver(resource_saver_png); + resource_saver_png.unref(); } void register_driver_types() { diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index 21343214c1..b38de75caa 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -314,9 +314,9 @@ void register_gdnative_types() { ClassDB::register_class<GDNative>(); resource_loader_gdnlib.instance(); - resource_saver_gdnlib.instance(); - ResourceLoader::add_resource_format_loader(resource_loader_gdnlib); + + resource_saver_gdnlib.instance(); ResourceSaver::add_resource_format_saver(resource_saver_gdnlib); GDNativeCallRegistry::singleton = memnew(GDNativeCallRegistry); @@ -395,9 +395,9 @@ void unregister_gdnative_types() { #endif ResourceLoader::remove_resource_format_loader(resource_loader_gdnlib); - ResourceSaver::remove_resource_format_saver(resource_saver_gdnlib); - resource_loader_gdnlib.unref(); + + ResourceSaver::remove_resource_format_saver(resource_saver_gdnlib); resource_saver_gdnlib.unref(); // This is for printing out the sizes of the core types diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.h b/modules/gdnative/videodecoder/video_stream_gdnative.h index 7712928b33..f9dec46b72 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.h +++ b/modules/gdnative/videodecoder/video_stream_gdnative.h @@ -197,6 +197,7 @@ public: }; class ResourceFormatLoaderVideoStreamGDNative : public ResourceFormatLoader { + GDCLASS(ResourceFormatLoaderVideoStreamGDNative, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 4eb31015c2..b8a13ed91b 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -161,13 +161,9 @@ void unregister_gdscript_types() { if (script_language_gd) memdelete(script_language_gd); - if (resource_loader_gd.is_valid()) { - ResourceLoader::remove_resource_format_loader(resource_loader_gd); - resource_loader_gd.unref(); - } + ResourceLoader::remove_resource_format_loader(resource_loader_gd); + resource_loader_gd.unref(); - if (resource_saver_gd.is_valid()) { - ResourceSaver::remove_resource_format_saver(resource_saver_gd); - resource_saver_gd.unref(); - } + ResourceSaver::remove_resource_format_saver(resource_saver_gd); + resource_saver_gd.unref(); } diff --git a/modules/mono/register_types.cpp b/modules/mono/register_types.cpp index ba008dffd4..3607b6f8b3 100644 --- a/modules/mono/register_types.cpp +++ b/modules/mono/register_types.cpp @@ -65,15 +65,11 @@ void unregister_mono_types() { if (script_language_cs) memdelete(script_language_cs); - if (resource_loader_cs.is_valid()) { - ResourceLoader::remove_resource_format_loader(resource_loader_cs); - resource_loader_cs.unref(); - } - - if (resource_saver_cs.is_valid()) { - ResourceSaver::remove_resource_format_saver(resource_saver_cs); - resource_saver_cs.unref(); - } + ResourceLoader::remove_resource_format_loader(resource_loader_cs); + resource_loader_cs.unref(); + + ResourceSaver::remove_resource_format_saver(resource_saver_cs); + resource_saver_cs.unref(); if (_godotsharp) memdelete(_godotsharp); diff --git a/modules/theora/register_types.cpp b/modules/theora/register_types.cpp index 894952985e..4b50c3f146 100644 --- a/modules/theora/register_types.cpp +++ b/modules/theora/register_types.cpp @@ -45,8 +45,5 @@ void register_theora_types() { void unregister_theora_types() { ResourceLoader::remove_resource_format_loader(resource_loader_theora); - - if (resource_loader_theora.is_valid()) { - resource_loader_theora.unref(); - } + resource_loader_theora.unref(); } diff --git a/modules/webm/register_types.cpp b/modules/webm/register_types.cpp index 1a26f08d38..ad8e2cf310 100644 --- a/modules/webm/register_types.cpp +++ b/modules/webm/register_types.cpp @@ -45,8 +45,5 @@ void register_webm_types() { void unregister_webm_types() { ResourceLoader::remove_resource_format_loader(resource_loader_webm); - - if (resource_loader_webm.is_valid()) { - resource_loader_webm.unref(); - } + resource_loader_webm.unref(); } diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index b50b8cfb6d..3281081897 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -746,27 +746,20 @@ void unregister_scene_types() { DynamicFont::finish_dynamic_fonts(); - if (resource_saver_text.is_valid()) { - ResourceSaver::remove_resource_format_saver(resource_saver_text); - resource_saver_text.unref(); - } - if (resource_loader_text.is_valid()) { - ResourceLoader::remove_resource_format_loader(resource_loader_text); - resource_loader_text.unref(); - } + ResourceSaver::remove_resource_format_saver(resource_saver_text); + resource_saver_text.unref(); - if (resource_saver_shader.is_valid()) { - ResourceSaver::remove_resource_format_saver(resource_saver_shader); - resource_saver_shader.unref(); - } - if (resource_loader_shader.is_valid()) { - ResourceLoader::remove_resource_format_loader(resource_loader_shader); - resource_loader_shader.unref(); - } - if (resource_loader_bmfont.is_valid()) { - ResourceLoader::remove_resource_format_loader(resource_loader_bmfont); - resource_loader_bmfont.unref(); - } + ResourceLoader::remove_resource_format_loader(resource_loader_text); + resource_loader_text.unref(); + + ResourceSaver::remove_resource_format_saver(resource_saver_shader); + resource_saver_shader.unref(); + + ResourceLoader::remove_resource_format_loader(resource_loader_shader); + resource_loader_shader.unref(); + + ResourceLoader::remove_resource_format_loader(resource_loader_bmfont); + resource_loader_bmfont.unref(); SpatialMaterial::finish_shaders(); ParticlesMaterial::finish_shaders(); |