[Bf-blender-cvs] [cc1a0fc3142] greasepencil-object: Fix: Newly created palettes for palette slots got an extra/unneeded user

Joshua Leung noreply at git.blender.org
Wed Oct 4 14:17:16 CEST 2017


Commit: cc1a0fc314285ed0d925bb9a6b2dcf8fa1be85c3
Author: Joshua Leung
Date:   Wed Oct 4 14:27:05 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rBcc1a0fc314285ed0d925bb9a6b2dcf8fa1be85c3

Fix: Newly created palettes for palette slots got an extra/unneeded user

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

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

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 0a903256720..cacd97ea5db 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1516,8 +1516,11 @@ bGPDpaletteref *BKE_gpencil_paletteslot_validate(Main *bmain, bGPdata *gpd)
 	/* ensure a palette exists */
 	/* XXX: use "active palette" instead of making a new one each time? */
 	if (palslot->palette == NULL) {
+		/* NOTE: no need to increment user count when setting this one here,
+		 * as the db already has 2 users (1 from "Fake User", and the other
+		 * is for whoever uses it now - i.e. the palette slot!)
+		 */
 		palslot->palette = BKE_palette_add(bmain, "Palette");
-		id_us_plus(&palslot->palette->id);
 	}
 	
 	/* ensure the palette has colors, and that the active one is usable */



More information about the Bf-blender-cvs mailing list