summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2023-07-29 10:56:28 -0500
committerGitHub <noreply@github.com>2023-07-29 10:56:28 -0500
commit75f9c97deaa8378477441e07ea1782ecab6d2eca (patch)
treecfd67bc9b4569c9948e9d2ca8027e8ff600ab8e2
parent031aa99d313ceec7cdb8263957d22cae10de0b95 (diff)
parentabd0dcac88deead8da28994a18daac47884d7047 (diff)
downloadredot-engine-75f9c97deaa8378477441e07ea1782ecab6d2eca.tar.gz
Merge pull request #79981 from RandomShaper/fix_res_imp_life_2
Fix life cycle of ResourceImporterTexture better
-rw-r--r--editor/import/resource_importer_texture.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 793926214a..57139a511f 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -790,12 +790,16 @@ bool ResourceImporterTexture::are_import_settings_valid(const String &p_path) co
ResourceImporterTexture *ResourceImporterTexture::singleton = nullptr;
ResourceImporterTexture::ResourceImporterTexture() {
- singleton = this;
+ if (!singleton) {
+ singleton = this;
+ }
CompressedTexture2D::request_3d_callback = _texture_reimport_3d;
CompressedTexture2D::request_roughness_callback = _texture_reimport_roughness;
CompressedTexture2D::request_normal_callback = _texture_reimport_normal;
}
ResourceImporterTexture::~ResourceImporterTexture() {
- singleton = nullptr;
+ if (singleton == this) {
+ singleton = nullptr;
+ }
}