Closed qarmin closed 4 years ago
CC @JFonS
This is a race condition that occurs when set_noise(Ref
Is this a good way to prevent this? I'd like to make a PR but I'm not sure about the solution.
index ec67030a65..fbb1eb5616 100644
--- a/modules/opensimplex/noise_texture.cpp
+++ b/modules/opensimplex/noise_texture.cpp
@@ -137,14 +137,17 @@ void NoiseTexture::_queue_update() {
Ref<Image> NoiseTexture::_generate_texture() {
- if (noise.is_null()) return Ref<Image>();
+ // Prevent memdelete due to unref() on other thread.
+ Ref<OpenSimplexNoise> ref_noise = noise;
+
+ if (ref_noise.is_null()) return Ref<Image>();
Ref<Image> image;
if (seamless) {
- image = noise->get_seamless_image(size.x);
+ image = ref_noise->get_seamless_image(size.x);
} else {
- image = noise->get_image(size.x, size.y);
+ image = ref_noise->get_image(size.x, size.y);
}
if (as_normalmap) {
Godot version: 4.0.dev.custom_build. f65781fe7
OS/device including version: Ubuntu 19.10
Issue description: Backtrace:
Address Sanitizer Log
Steps to reproduce: Run Project
Minimal reproduction project: The-worst-Godot-test-project.zip