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:
authorCampbell Barton <ideasman42@gmail.com>2010-01-13 15:16:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-13 15:16:10 +0300
commit3c888b63f0e7dfeff5003a80857a0285b29395c1 (patch)
tree0677ca3fcb0771ad905c9cf0a46ba1f2d413b00e /source/blender/editors/sculpt_paint
parente691c9d1512b480406e8fbda6abc743a9369f4e9 (diff)
fix crash for projection painting with subsurf or multires, while drawing the verts & faces were bening freed.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 77e90e3c7b1..17223e3bc4a 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -2840,7 +2840,17 @@ static void project_paint_begin(ProjPaintState *ps)
}
}
-
+ /* when using subsurf or multires, mface arrays are thrown away, we need to keep a copy */
+ if(ps->dm->type != DM_TYPE_CDDM) {
+ ps->dm_mvert= MEM_dupallocN(ps->dm_mvert);
+ ps->dm_mface= MEM_dupallocN(ps->dm_mface);
+ /* looks like these are ok for now.*/
+ /*
+ ps->dm_mtface= MEM_dupallocN(ps->dm_mtface);
+ ps->dm_mtface_clone= MEM_dupallocN(ps->dm_mtface_clone);
+ ps->dm_mtface_stencil= MEM_dupallocN(ps->dm_mtface_stencil);
+ */
+ }
ps->viewDir[0] = 0.0f;
ps->viewDir[1] = 0.0f;
@@ -3266,6 +3276,18 @@ static void project_paint_end(ProjPaintState *ps)
BLI_memarena_free(ps->arena_mt[a]);
}
+ /* copy for subsurf/multires, so throw away */
+ if(ps->dm->type != DM_TYPE_CDDM) {
+ if(ps->dm_mvert) MEM_freeN(ps->dm_mvert);
+ if(ps->dm_mface) MEM_freeN(ps->dm_mface);
+ /* looks like these dont need copying */
+ /*
+ if(ps->dm_mtface) MEM_freeN(ps->dm_mtface);
+ if(ps->dm_mtface_clone) MEM_freeN(ps->dm_mtface_clone);
+ if(ps->dm_mtface_stencil) MEM_freeN(ps->dm_mtface_stencil);
+ */
+ }
+
if(ps->dm_release)
ps->dm->release(ps->dm);
}