Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-24 21:31:09 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-24 21:31:09 +0400
commitdbeec2be86db5b4ba440175e59c52ff84eb98462 (patch)
tree8bedb75ea7937279d318b86f5eecc98f8e03a950 /source/blender/render
parent64e28b21ba8472f4fd822b918d6e7d7c1be87dcb (diff)
Fix #34783: smoke simulation crash when changing frame while preview rendering.
Added a mutex lock for smoke data access. The render was already working with a copy of the volume data, so it's just a short lock to copy things and should not block the UI much.
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/source/voxeldata.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 9990ad7e900..1c76a228566 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -42,6 +42,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_threads.h"
#include "BLI_voxel.h"
#include "BLI_utildefines.h"
@@ -239,6 +240,13 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
SmokeDomainSettings *sds = smd->domain;
if (sds && sds->fluid) {
+ BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
+
+ if (!sds->fluid) {
+ BLI_rw_mutex_unlock(sds->fluid_mutex);
+ return;
+ }
+
if (cfra < sds->point_cache[0]->startframe)
; /* don't show smoke before simulation starts, this could be made an option in the future */
else if (vd->smoked_type == TEX_VD_SMOKEHEAT) {
@@ -246,7 +254,10 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
size_t i;
float *heat;
- if (!smoke_has_heat(sds->fluid)) return;
+ if (!smoke_has_heat(sds->fluid)) {
+ BLI_rw_mutex_unlock(sds->fluid_mutex);
+ return;
+ }
copy_v3_v3_int(vd->resol, sds->res);
totRes = vd_resol_size(vd);
@@ -283,12 +294,18 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
float *flame;
if (sds->flags & MOD_SMOKE_HIGHRES) {
- if (!smoke_turbulence_has_fuel(sds->wt)) return;
+ if (!smoke_turbulence_has_fuel(sds->wt)) {
+ BLI_rw_mutex_unlock(sds->fluid_mutex);
+ return;
+ }
smoke_turbulence_get_res(sds->wt, vd->resol);
flame = smoke_turbulence_get_flame(sds->wt);
}
else {
- if (!smoke_has_fuel(sds->fluid)) return;
+ if (!smoke_has_fuel(sds->fluid)) {
+ BLI_rw_mutex_unlock(sds->fluid_mutex);
+ return;
+ }
copy_v3_v3_int(vd->resol, sds->res);
flame = smoke_get_flame(sds->fluid);
}
@@ -333,6 +350,8 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
}
}
} /* end of fluid condition */
+
+ BLI_rw_mutex_unlock(sds->fluid_mutex);
}
}