[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45803] branches/smoke2/source/blender/ blenkernel/intern/smoke.c: Fix collision objects: Crash when no domain was available.

Daniel Genrich daniel.genrich at gmx.net
Fri Apr 20 13:08:58 CEST 2012


Revision: 45803
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45803
Author:   genscher
Date:     2012-04-20 11:08:58 +0000 (Fri, 20 Apr 2012)
Log Message:
-----------
Fix collision objects: Crash when no domain was available.

Modified Paths:
--------------
    branches/smoke2/source/blender/blenkernel/intern/smoke.c

Modified: branches/smoke2/source/blender/blenkernel/intern/smoke.c
===================================================================
--- branches/smoke2/source/blender/blenkernel/intern/smoke.c	2012-04-20 10:52:13 UTC (rev 45802)
+++ branches/smoke2/source/blender/blenkernel/intern/smoke.c	2012-04-20 11:08:58 UTC (rev 45803)
@@ -797,21 +797,24 @@
 	{
 		SmokeCollSettings *scs = smd->coll;
 
-		if(scs->points)
+		if(scs->numpoints)
 		{
-			MEM_freeN(scs->points);
-			scs->points = NULL;
+			if(scs->points)
+			{
+				MEM_freeN(scs->points);
+				scs->points = NULL;
+			}
+			if(scs->points_old)
+			{
+				MEM_freeN(scs->points_old);
+				scs->points_old = NULL;
+			}
+			if(scs->tridivs)
+			{
+				MEM_freeN(scs->tridivs);
+				scs->tridivs = NULL;
+			}
 		}
-		if(scs->points_old)
-		{
-			MEM_freeN(scs->points_old);
-			scs->points_old = NULL;
-		}
-		if(scs->tridivs)
-		{
-			MEM_freeN(scs->tridivs);
-			scs->tridivs = NULL;
-		}
 
 		if(scs->bvhtree)
 		{
@@ -876,7 +879,7 @@
 		{
 			SmokeCollSettings *scs = smd->coll;
 
-			if(scs->points)
+			if(scs->numpoints && scs->points)
 			{
 				MEM_freeN(scs->points);
 				scs->points = NULL;
@@ -978,6 +981,7 @@
 			smd->coll->points = NULL;
 			smd->coll->points_old = NULL;
 			smd->coll->tridivs = NULL;
+			smd->coll->vel = NULL;
 			smd->coll->numpoints = 0;
 			smd->coll->numtris = 0;
 			smd->coll->bvhtree = NULL;
@@ -1681,12 +1685,12 @@
 	{
 		/* Check if domain resolution changed */
 		/* DG TODO: can this be solved more elegant using dependancy graph? */
-		if(smd->coll)
 		{
 			SmokeCollSettings *scs = smd->coll;
 			Base *base = scene->base.first;
 			int changed = 0;
 			float dx = FLT_MAX;
+			int haveDomain = 0;
 
 			for ( ; base; base = base->next) 
 			{
@@ -1701,8 +1705,13 @@
 						dx = sds->dx;
 						changed = 1;
 					}
+
+					haveDomain = 1;
 				}
 			}
+
+			if(!haveDomain)
+				return;
 			
 			if(changed)
 			{




More information about the Bf-blender-cvs mailing list