[Bf-blender-cvs] [a937bb8b0dd] fluid-mantaflow: Mantaflow: Fix crash when freeing bake with unknown cache directory
Sebastián Barschkis
noreply at git.blender.org
Fri Sep 27 17:38:50 CEST 2019
Commit: a937bb8b0ddca2911981f319efbbba6ef80b19b0
Author: Sebastián Barschkis
Date: Fri Sep 27 17:38:42 2019 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBa937bb8b0ddca2911981f319efbbba6ef80b19b0
Mantaflow: Fix crash when freeing bake with unknown cache directory
===================================================================
M source/blender/blenkernel/intern/manta.c
M source/blender/editors/physics/physics_manta.c
===================================================================
diff --git a/source/blender/blenkernel/intern/manta.c b/source/blender/blenkernel/intern/manta.c
index 9bfb2205bc1..f72ab70ff19 100644
--- a/source/blender/blenkernel/intern/manta.c
+++ b/source/blender/blenkernel/intern/manta.c
@@ -1727,8 +1727,8 @@ static void emit_from_particles(Object *flow_ob,
totchild = psys->totchild * psys->part->disp / 100;
}
- particle_pos = MEM_callocN(sizeof(float) * (totpart + totchild) * 3, "manta_flow_particles");
- particle_vel = MEM_callocN(sizeof(float) * (totpart + totchild) * 3, "manta_flow_particles");
+ particle_pos = MEM_callocN(sizeof(float) * (totpart + totchild) * 3, "manta_flow_particles_pos");
+ particle_vel = MEM_callocN(sizeof(float) * (totpart + totchild) * 3, "manta_flow_particles_vel");
/* setup particle radius emission if enabled */
if (sfs->flags & FLUID_FLOW_USE_PART_SIZE) {
diff --git a/source/blender/editors/physics/physics_manta.c b/source/blender/editors/physics/physics_manta.c
index 240c1410147..76c5c285572 100644
--- a/source/blender/editors/physics/physics_manta.c
+++ b/source/blender/editors/physics/physics_manta.c
@@ -163,7 +163,7 @@ static bool manta_initpaths(MantaJob *job, ReportList *reports)
BLI_strncpy(tmpDir, mds->cache_directory, FILE_MAXDIR);
BLI_path_abs(tmpDir, relbase);
- /* Ensure whole path exists and is wirtable. */
+ /* Ensure whole path exists and is writable. */
if (!BLI_dir_create_recursive(tmpDir)) {
BKE_reportf(reports,
RPT_ERROR,
@@ -171,6 +171,9 @@ static bool manta_initpaths(MantaJob *job, ReportList *reports)
"please define a valid cache path manually",
tmpDir);
}
+ /* Copy final dir back into domain settings */
+ BLI_strncpy(mds->cache_directory, tmpDir, FILE_MAXDIR);
+
return false;
}
@@ -518,7 +521,9 @@ static int manta_bake_exec(struct bContext *C, struct wmOperator *op)
manta_bake_free(job);
return OPERATOR_CANCELLED;
}
- manta_initpaths(job, op->reports);
+ if (!manta_initpaths(job, op->reports)) {
+ return OPERATOR_CANCELLED;
+ }
manta_bake_startjob(job, NULL, NULL, NULL);
manta_bake_endjob(job);
manta_bake_free(job);
@@ -542,7 +547,9 @@ static int manta_bake_invoke(struct bContext *C,
return OPERATOR_CANCELLED;
}
- manta_initpaths(job, op->reports);
+ if (!manta_initpaths(job, op->reports)) {
+ return OPERATOR_CANCELLED;
+ }
wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C),
CTX_wm_window(C),
@@ -552,7 +559,7 @@ static int manta_bake_invoke(struct bContext *C,
WM_JOB_TYPE_OBJECT_SIM_MANTA);
WM_jobs_customdata_set(wm_job, job, manta_bake_free);
- WM_jobs_timer(wm_job, 0.1, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER);
+ WM_jobs_timer(wm_job, 0.01, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER);
WM_jobs_callbacks(wm_job, manta_bake_startjob, NULL, NULL, manta_bake_endjob);
WM_set_locked_interface(CTX_wm_manager(C), true);
@@ -613,7 +620,9 @@ static int manta_free_exec(struct bContext *C, struct wmOperator *op)
job->type = op->type->idname;
job->name = op->type->name;
- manta_initpaths(job, op->reports);
+ if (!manta_initpaths(job, op->reports)) {
+ return OPERATOR_CANCELLED;
+ }
wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C),
CTX_wm_window(C),
@@ -623,7 +632,7 @@ static int manta_free_exec(struct bContext *C, struct wmOperator *op)
WM_JOB_TYPE_OBJECT_SIM_MANTA);
WM_jobs_customdata_set(wm_job, job, manta_bake_free);
- WM_jobs_timer(wm_job, 0.1, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER);
+ WM_jobs_timer(wm_job, 0.01, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER);
WM_jobs_callbacks(wm_job, manta_free_startjob, NULL, NULL, manta_free_endjob);
WM_set_locked_interface(CTX_wm_manager(C), true);
More information about the Bf-blender-cvs
mailing list