From 7860b74b0f53393c8a1f0c5f2961b4b8e62bce43 Mon Sep 17 00:00:00 2001 From: Marcin Zawiejski Date: Thu, 10 Jan 2019 07:19:16 +0100 Subject: Remove vsgdnative loader on exit --- modules/gdnative/videodecoder/register_types.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/gdnative/videodecoder/register_types.cpp b/modules/gdnative/videodecoder/register_types.cpp index f2c4ab6d3b..ea78cb1970 100644 --- a/modules/gdnative/videodecoder/register_types.cpp +++ b/modules/gdnative/videodecoder/register_types.cpp @@ -33,18 +33,18 @@ #include "core/class_db.h" #include "video_stream_gdnative.h" -static ResourceFormatLoaderVideoStreamGDNative *resource_loader_vsgdnative = NULL; +static Ref resource_loader_vsgdnative; void register_videodecoder_types() { - resource_loader_vsgdnative = memnew(ResourceFormatLoaderVideoStreamGDNative); + resource_loader_vsgdnative.instance(); ResourceLoader::add_resource_format_loader(resource_loader_vsgdnative, true); + ClassDB::register_class(); } void unregister_videodecoder_types() { - if (resource_loader_vsgdnative) { - memdelete(resource_loader_vsgdnative); - } + ResourceLoader::remove_resource_format_loader(resource_loader_vsgdnative); + resource_loader_vsgdnative.unref(); } -- cgit v1.2.3