following on from last commit r36263.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 21 Apr 2011 09:38:09 +0000 (09:38 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 21 Apr 2011 09:38:09 +0000 (09:38 +0000)
copying metaball, lattice and armature datablocks while in editmode could segfault when they were freed, NULL these pointers on copy.

source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/mball.c

index a0511f5da2e8dd4be381f885026c399a653fe5c5..a79637eea7302a86ab57453c3f1c32aac059b82a 100644 (file)
@@ -214,6 +214,11 @@ bArmature *copy_armature(bArmature *arm)
        };
        
        newArm->act_bone= newActBone;
+
+       newArm->edbo= NULL;
+       newArm->act_edbone= NULL;
+       newArm->sketch= NULL;
+
        return newArm;
 }
 
index 7a5e0d5c33d0a6c090fe253a172a2fcb685def6b..f68533803e7cbe5cd03aadc3df972dd62280da8c 100644 (file)
@@ -201,6 +201,7 @@ Curve *copy_curve(Curve *cu)
 
        cun->editnurb= NULL;
        cun->editfont= NULL;
+       cun->selboxes= NULL;
 
 #if 0  // XXX old animation system
        /* single user ipo too */
index 9d93bb1c25d721a1f79e802150d7b05d10a3d050..d308ccbf876c18514823b10be4043ec88b5236c4 100644 (file)
@@ -219,7 +219,9 @@ Lattice *copy_lattice(Lattice *lt)
                ltn->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
                copy_dverts(ltn->dvert, lt->dvert, tot);
        }
-       
+
+       ltn->editlatt= NULL;
+
        return ltn;
 }
 
index 74e31238b966e2505676c5a6b4428a7581794876..6fe9e3782902681c8637429fe4de60eea0372b78 100644 (file)
@@ -132,6 +132,9 @@ MetaBall *copy_mball(MetaBall *mb)
                id_us_plus((ID *)mbn->mat[a]);
        }
        mbn->bb= MEM_dupallocN(mb->bb);
+
+       mbn->editelems= NULL;
+       mbn->lastelem= NULL;
        
        return mbn;
 }