diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2007-05-03 23:11:54 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2007-05-03 23:11:54 +0400 |
commit | 674f23c5361f249e28d6cf60daec6b213b0bf20b (patch) | |
tree | 297b92e023575ce6aed1f603bb9ba982d4f23d0d | |
parent | c71949419ed68ef1026b4ac7ac391a51ce055ae8 (diff) |
== Sculpt Mode ==
Fixed bug #6639 ] Sculpt mode clearing brush texture causes a crash (null pointer)
* Added code to clear the brush texture preview (used for propset) when deleting a brush texture
* Added a check in tex_strength() for an empty (NULL) texture slot to prevent the crash
-rw-r--r-- | source/blender/src/sculptmode.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/src/sculptmode.c b/source/blender/src/sculptmode.c index 2d21802d548..7c3b8b69e24 100644 --- a/source/blender/src/sculptmode.c +++ b/source/blender/src/sculptmode.c @@ -309,9 +309,15 @@ void sculptmode_rem_tex(void *junk0,void *junk1) { MTex *mtex= G.scene->sculptdata.mtex[G.scene->sculptdata.texact]; if(mtex) { + SculptSession *ss= sculpt_session(); if(mtex->tex) mtex->tex->id.us--; MEM_freeN(mtex); G.scene->sculptdata.mtex[G.scene->sculptdata.texact]= NULL; + /* Clear brush preview */ + if(ss->texcache) { + MEM_freeN(ss->texcache); + ss->texcache= NULL; + } BIF_undo_push("Unlink brush texture"); allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWOOPS, 0); @@ -783,7 +789,7 @@ float tex_strength(EditData *e, float *point, const float len,const unsigned vin SculptSession *ss= sculpt_session(); float avg= 1; - if(sd->texact==-1) + if(sd->texact==-1 || !sd->mtex[sd->texact]) avg= 1; else if(sd->texrept==SCULPTREPT_3D) { /* Get strength by feeding the vertex location directly |