[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56737] branches/ge_harmony/source/blender /blenkernel/intern/shader.c: Fixing a crash that could occur when changing shader sources from built in to a different source .

Daniel Stokes kupomail at gmail.com
Mon May 13 04:17:09 CEST 2013


Revision: 56737
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56737
Author:   kupoman
Date:     2013-05-13 02:17:08 +0000 (Mon, 13 May 2013)
Log Message:
-----------
Fixing a crash that could occur when changing shader sources from built in to a different source.

Modified Paths:
--------------
    branches/ge_harmony/source/blender/blenkernel/intern/shader.c

Modified: branches/ge_harmony/source/blender/blenkernel/intern/shader.c
===================================================================
--- branches/ge_harmony/source/blender/blenkernel/intern/shader.c	2013-05-13 02:10:59 UTC (rev 56736)
+++ branches/ge_harmony/source/blender/blenkernel/intern/shader.c	2013-05-13 02:17:08 UTC (rev 56737)
@@ -415,8 +415,10 @@
 	Uniform *uni;
 
 	/* Clean up an previous source text */
-	if (sh->source)
+	if (sh->source) {
 		MEM_freeN(sh->source);
+		sh->source = NULL;
+	}
 
 	if (sh->location == SHADER_LOC_INTERNAL)
 		sh->source = txt_to_buf(sh->sourcetext);
@@ -428,5 +430,7 @@
 		BLI_ghash_insert(sh->uniform_cache, uni->id, uni);
 
 	sh->uniforms.first = sh->uniforms.last = NULL;
-	gather_uniforms(sh);
+
+	if (sh->source)
+		gather_uniforms(sh);
 }
\ No newline at end of file




More information about the Bf-blender-cvs mailing list