[Bf-blender-cvs] [7a6d7d056be] blender2.8: Fix T56273: User count assert on re-saving a particular file.

Bastien Montagne noreply at git.blender.org
Wed Aug 8 11:57:01 CEST 2018


Commit: 7a6d7d056bee4336e891b83b7bba8ab41de36ebf
Author: Bastien Montagne
Date:   Wed Aug 8 11:54:58 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB7a6d7d056bee4336e891b83b7bba8ab41de36ebf

Fix T56273: User count assert on re-saving a particular file.

new background image/clip of Camera ID was totally wrong, down the old,
broken 'way it used to be' instead of using new, more generic system.

Those ID pointers were not even added to library_query.c file, shame! xD

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

M	source/blender/blenkernel/intern/camera.c
M	source/blender/blenkernel/intern/library_query.c

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

diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 1b5995de4f0..07b0e3b782e 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -108,16 +108,6 @@ void *BKE_camera_add(Main *bmain, const char *name)
 void BKE_camera_copy_data(Main *UNUSED(bmain), Camera *cam_dst, const Camera *cam_src, const int flag)
 {
 	BLI_duplicatelist(&cam_dst->bg_images, &cam_src->bg_images);
-	if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
-		for (CameraBGImage *bgpic = cam_dst->bg_images.first; bgpic; bgpic = bgpic->next) {
-			if (bgpic->source == CAM_BGIMG_SOURCE_IMAGE) {
-				id_us_plus((ID *)bgpic->ima);
-			}
-			else if (bgpic->source == CAM_BGIMG_SOURCE_MOVIE) {
-				id_us_plus((ID *)bgpic->clip);
-			}
-		}
-	}
 }
 
 Camera *BKE_camera_copy(Main *bmain, const Camera *cam)
@@ -135,14 +125,6 @@ void BKE_camera_make_local(Main *bmain, Camera *cam, const bool lib_local)
 /** Free (or release) any data used by this camera (does not free the camera itself). */
 void BKE_camera_free(Camera *ca)
 {
-	for (CameraBGImage *bgpic = ca->bg_images.first; bgpic; bgpic = bgpic->next) {
-		if (bgpic->source == CAM_BGIMG_SOURCE_IMAGE) {
-			id_us_min((ID *)bgpic->ima);
-		}
-		else if (bgpic->source == CAM_BGIMG_SOURCE_MOVIE) {
-			id_us_min((ID *)bgpic->clip);
-		}
-	}
 	BLI_freelistN(&ca->bg_images);
 
 	BKE_animdata_free((ID *)ca, false);
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 473dd787a69..0626e051e83 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -682,6 +682,15 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
 			{
 				Camera *camera = (Camera *) id;
 				CALLBACK_INVOKE(camera->dof_ob, IDWALK_CB_NOP);
+				for (CameraBGImage *bgpic = camera->bg_images.first; bgpic; bgpic = bgpic->next) {
+					if (bgpic->source == CAM_BGIMG_SOURCE_IMAGE) {
+						CALLBACK_INVOKE(bgpic->ima, IDWALK_CB_USER);
+					}
+					else if (bgpic->source == CAM_BGIMG_SOURCE_MOVIE) {
+						CALLBACK_INVOKE(bgpic->clip, IDWALK_CB_USER);
+					}
+				}
+
 				break;
 			}



More information about the Bf-blender-cvs mailing list