[Bf-blender-cvs] [6663099810] master: Fix T50590: BI lamp doesn't hold a texture in this case.

Bastien Montagne noreply at git.blender.org
Sat Feb 4 21:32:03 CET 2017


Commit: 6663099810f5708046dec792ab13f4321a5d0248
Author: Bastien Montagne
Date:   Sat Feb 4 21:29:51 2017 +0100
Branches: master
https://developer.blender.org/rB6663099810f5708046dec792ab13f4321a5d0248

Fix T50590: BI lamp doesn't hold a texture in this case.

BKE_lamp_free was somehow missing the refactor of datablocks handling
(which, among other things, completely separated ID refcounting and
linking management from ID freeing itself).

Either forgot during development, or lost during merge...

===================================================================

M	source/blender/blenkernel/intern/lamp.c

===================================================================

diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index d098366aef..69a2067f4e 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -174,15 +174,10 @@ void BKE_lamp_make_local(Main *bmain, Lamp *la, const bool lib_local)
 
 void BKE_lamp_free(Lamp *la)
 {
-	MTex *mtex;
 	int a;
 
 	for (a = 0; a < MAX_MTEX; a++) {
-		mtex = la->mtex[a];
-		if (mtex && mtex->tex)
-			id_us_min(&mtex->tex->id);
-		if (mtex)
-			MEM_freeN(mtex);
+		MEM_SAFE_FREE(la->mtex[a]);
 	}
 	
 	BKE_animdata_free((ID *)la, false);
@@ -193,6 +188,7 @@ void BKE_lamp_free(Lamp *la)
 	if (la->nodetree) {
 		ntreeFreeTree(la->nodetree);
 		MEM_freeN(la->nodetree);
+		la->nodetree = NULL;
 	}
 	
 	BKE_previewimg_free(&la->preview);




More information about the Bf-blender-cvs mailing list