[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16556] trunk/blender/source/blender: "Fix " for #17636 Crashing bug - won't open a file

Janne Karhu jhkarh at utu.fi
Tue Sep 16 20:41:51 CEST 2008


Revision: 16556
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16556
Author:   jhk
Date:     2008-09-16 20:40:54 +0200 (Tue, 16 Sep 2008)

Log Message:
-----------
"Fix" for #17636 Crashing bug - won't open a file
- The cause was indeed corrupted particle settings which should have caused a deletion of the whole particle system. However the particle modifier was still left and that led to the crash.
- A "fix" because there's really no way of knowing what caused the corruption of the particle settings. If anyone else gets this and can recreate I'd love to get a .blend. Now that there shouldn't be a crash anymore the symptom will be a missing particle system after file load in an object that had a particle system before.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/depsgraph.c
    trunk/blender/source/blender/blenkernel/intern/particle.c
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenkernel/intern/depsgraph.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/depsgraph.c	2008-09-16 16:20:51 UTC (rev 16555)
+++ trunk/blender/source/blender/blenkernel/intern/depsgraph.c	2008-09-16 18:40:54 UTC (rev 16556)
@@ -581,9 +581,12 @@
 
 		for(; psys; psys=psys->next) {
 			ParticleSettings *part= psys->part;
-			
+
 			dag_add_relation(dag, node, node, DAG_RL_OB_DATA, "Particle-Object Relation");
 
+			if(psys->flag & PSYS_DISABLED || psys->flag & PSYS_DELETE)
+				continue;
+
 			if(part->phystype==PART_PHYS_KEYED && psys->keyed_ob &&
 			   BLI_findlink(&psys->keyed_ob->particlesystem,psys->keyed_psys-1)) {
 				node2 = dag_get_node(dag, psys->keyed_ob);

Modified: trunk/blender/source/blender/blenkernel/intern/particle.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle.c	2008-09-16 16:20:51 UTC (rev 16555)
+++ trunk/blender/source/blender/blenkernel/intern/particle.c	2008-09-16 18:40:54 UTC (rev 16556)
@@ -296,7 +296,7 @@
 	ParticleSystemModifierData *psmd;
 	Mesh *me;
 
-	if(psys->flag & PSYS_DISABLED)
+	if(psys->flag & PSYS_DISABLED || psys->flag & PSYS_DELETE)
 		return 0;
 
 	if(ob->type == OB_MESH) {

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2008-09-16 16:20:51 UTC (rev 16555)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2008-09-16 18:40:54 UTC (rev 16556)
@@ -2596,7 +2596,7 @@
 	part->pd2= newdataadr(fd, part->pd2);
 }
 
-static void lib_link_particlesystems(FileData *fd, ID *id, ListBase *particles)
+static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase *particles)
 {
 	ParticleSystem *psys, *psysnext;
 	int a;
@@ -2616,6 +2616,11 @@
 			}
 		}
 		else {
+			/* particle modifier must be removed before particle system */
+			ParticleSystemModifierData *psmd= psys_get_modifier(ob,psys);
+			BLI_remlink(&ob->modifiers, psmd);
+			modifier_free((ModifierData *)psmd);
+
 			BLI_remlink(particles, psys);
 			MEM_freeN(psys);
 		}
@@ -3069,7 +3074,7 @@
 					ob->pd->tex=newlibadr_us(fd, ob->id.lib, ob->pd->tex);
 
 			lib_link_scriptlink(fd, &ob->id, &ob->scriptlink);
-			lib_link_particlesystems(fd, &ob->id, &ob->particlesystem);
+			lib_link_particlesystems(fd, ob, &ob->id, &ob->particlesystem);
 			lib_link_modifiers(fd, ob);
 		}
 		ob= ob->id.next;





More information about the Bf-blender-cvs mailing list