diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dummy/texture_loader_dummy.h | 1 | ||||
-rw-r--r-- | drivers/png/resource_saver_png.h | 1 | ||||
-rw-r--r-- | drivers/register_driver_types.cpp | 13 |
3 files changed, 10 insertions, 5 deletions
diff --git a/drivers/dummy/texture_loader_dummy.h b/drivers/dummy/texture_loader_dummy.h index f0a355ec12..6809e76331 100644 --- a/drivers/dummy/texture_loader_dummy.h +++ b/drivers/dummy/texture_loader_dummy.h @@ -35,6 +35,7 @@ #include "scene/resources/texture.h" class ResourceFormatDummyTexture : public ResourceFormatLoader { + GDCLASS(ResourceFormatDummyTexture, 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/drivers/png/resource_saver_png.h b/drivers/png/resource_saver_png.h index 34950f6723..2d5fd0882c 100644 --- a/drivers/png/resource_saver_png.h +++ b/drivers/png/resource_saver_png.h @@ -35,6 +35,7 @@ #include "core/io/resource_saver.h" class ResourceSaverPNG : public ResourceFormatSaver { + GDCLASS(ResourceSaverPNG, ResourceFormatSaver) public: static Error save_image(const String &p_path, const Ref<Image> &p_img); diff --git a/drivers/register_driver_types.cpp b/drivers/register_driver_types.cpp index 9f5d9c1abf..9a6e0f45fc 100644 --- a/drivers/register_driver_types.cpp +++ b/drivers/register_driver_types.cpp @@ -42,15 +42,15 @@ #include "platform/windows/export/export.h" #endif -static ImageLoaderPNG *image_loader_png = NULL; -static ResourceSaverPNG *resource_saver_png = NULL; +static ImageLoaderPNG *image_loader_png; +static Ref<ResourceSaverPNG> resource_saver_png; void register_core_driver_types() { image_loader_png = memnew(ImageLoaderPNG); ImageLoader::add_image_format_loader(image_loader_png); - resource_saver_png = memnew(ResourceSaverPNG); + resource_saver_png.instance(); ResourceSaver::add_resource_format_saver(resource_saver_png); } @@ -58,8 +58,11 @@ void unregister_core_driver_types() { if (image_loader_png) memdelete(image_loader_png); - if (resource_saver_png) - memdelete(resource_saver_png); + + if (resource_saver_png.is_valid()) { + ResourceSaver::remove_resource_format_saver(resource_saver_png); + resource_saver_png.unref(); + } } void register_driver_types() { |