Bladeren bron

Fix life cycle of ResourceImporterTexture better

Pedro J. Estébanez 2 jaren geleden
bovenliggende
commit
abd0dcac88
1 gewijzigde bestanden met toevoegingen van 6 en 2 verwijderingen
  1. 6 2
      editor/import/resource_importer_texture.cpp

+ 6 - 2
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;
+	}
 }