diff --git a/godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.cpp b/godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.cpp index 732cc322..98ce49ca 100644 --- a/godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.cpp +++ b/godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.cpp @@ -35,7 +35,7 @@ void KhronosEditorPlugin::_bind_methods() {} void KhronosEditorPlugin::_enter_tree() { // Initialize the editor export plugin - khronos_export_plugin = memnew(KhronosEditorExportPlugin); + khronos_export_plugin.instantiate(); add_export_plugin(khronos_export_plugin); } @@ -43,8 +43,7 @@ void KhronosEditorPlugin::_exit_tree() { // Clean up the editor export plugin remove_export_plugin(khronos_export_plugin); - memfree(khronos_export_plugin); - khronos_export_plugin = nullptr; + khronos_export_plugin.unref(); } KhronosEditorExportPlugin::KhronosEditorExportPlugin() { diff --git a/godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.h b/godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.h index 13a83403..8839e13c 100644 --- a/godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.h +++ b/godotopenxrkhronos/src/main/cpp/export/khronos_export_plugin.h @@ -58,5 +58,5 @@ class KhronosEditorPlugin : public EditorPlugin { static void _bind_methods(); private: - KhronosEditorExportPlugin *khronos_export_plugin = nullptr; + Ref khronos_export_plugin; }; diff --git a/godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.cpp b/godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.cpp index 4f480663..ada0aca5 100644 --- a/godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.cpp +++ b/godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.cpp @@ -35,7 +35,7 @@ void LynxEditorPlugin::_bind_methods() {} void LynxEditorPlugin::_enter_tree() { // Initialize the editor export plugin - lynx_export_plugin = memnew(OpenXREditorExportPlugin); + lynx_export_plugin.instantiate(); lynx_export_plugin->set_vendor_name(LYNX_VENDOR_NAME); add_export_plugin(lynx_export_plugin); } @@ -44,6 +44,5 @@ void LynxEditorPlugin::_exit_tree() { // Clean up the editor export plugin remove_export_plugin(lynx_export_plugin); - memfree(lynx_export_plugin); - lynx_export_plugin = nullptr; + lynx_export_plugin.unref(); } diff --git a/godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.h b/godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.h index c921c3e1..b0969806 100644 --- a/godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.h +++ b/godotopenxrlynx/src/main/cpp/export/lynx_export_plugin.h @@ -46,5 +46,5 @@ class LynxEditorPlugin : public EditorPlugin { static void _bind_methods(); private: - OpenXREditorExportPlugin *lynx_export_plugin = nullptr; + Ref lynx_export_plugin; }; diff --git a/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.cpp b/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.cpp index 3f5f41b4..89446d7c 100644 --- a/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.cpp +++ b/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.cpp @@ -37,7 +37,7 @@ void MetaEditorPlugin::_bind_methods() {} void MetaEditorPlugin::_enter_tree() { // Initialize the editor export plugin - meta_export_plugin = memnew(MetaEditorExportPlugin); + meta_export_plugin.instantiate(); add_export_plugin(meta_export_plugin); } @@ -45,8 +45,7 @@ void MetaEditorPlugin::_exit_tree() { // Clean up the editor export plugin remove_export_plugin(meta_export_plugin); - memfree(meta_export_plugin); - meta_export_plugin = nullptr; + meta_export_plugin.unref(); } MetaEditorExportPlugin::MetaEditorExportPlugin() { diff --git a/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.h b/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.h index 0b20d128..126bf6a5 100644 --- a/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.h +++ b/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.h @@ -101,6 +101,5 @@ class MetaEditorPlugin : public EditorPlugin { static void _bind_methods(); private: - MetaEditorExportPlugin *meta_export_plugin = nullptr; - + Ref meta_export_plugin; }; diff --git a/godotopenxrpico/src/main/cpp/export/pico_export_plugin.cpp b/godotopenxrpico/src/main/cpp/export/pico_export_plugin.cpp index 6e6e0f9b..9416a13c 100644 --- a/godotopenxrpico/src/main/cpp/export/pico_export_plugin.cpp +++ b/godotopenxrpico/src/main/cpp/export/pico_export_plugin.cpp @@ -35,7 +35,7 @@ void PicoEditorPlugin::_bind_methods() {} void PicoEditorPlugin::_enter_tree() { // Initialize the editor export plugin - pico_export_plugin = memnew(OpenXREditorExportPlugin); + pico_export_plugin.instantiate(); pico_export_plugin->set_vendor_name(PICO_VENDOR_NAME); add_export_plugin(pico_export_plugin); } @@ -44,6 +44,5 @@ void PicoEditorPlugin::_exit_tree() { // Clean up the editor export plugin remove_export_plugin(pico_export_plugin); - memfree(pico_export_plugin); - pico_export_plugin = nullptr; + pico_export_plugin.unref(); } diff --git a/godotopenxrpico/src/main/cpp/export/pico_export_plugin.h b/godotopenxrpico/src/main/cpp/export/pico_export_plugin.h index aa3d995a..72114e9a 100644 --- a/godotopenxrpico/src/main/cpp/export/pico_export_plugin.h +++ b/godotopenxrpico/src/main/cpp/export/pico_export_plugin.h @@ -46,5 +46,5 @@ class PicoEditorPlugin : public EditorPlugin { static void _bind_methods(); private: - OpenXREditorExportPlugin *pico_export_plugin = nullptr; + Ref pico_export_plugin; };