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.
This commit is contained in:
Rémi Verschelde
2019-01-10 12:45:57 +01:00
parent 940a2c5ec3
commit e5f1d19352
9 changed files with 39 additions and 70 deletions

View File

@@ -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

View File

@@ -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;