[Bf-blender-cvs] [e7544e3ce40] master: Fix (unreported) wrong ID usercount handling in background images removal.

Bastien Montagne noreply at git.blender.org
Mon May 30 16:58:56 CEST 2022


Commit: e7544e3ce4066cfb1759477a7cc4e405b6969067
Author: Bastien Montagne
Date:   Mon May 30 16:03:08 2022 +0200
Branches: master
https://developer.blender.org/rBe7544e3ce4066cfb1759477a7cc4e405b6969067

Fix (unreported) wrong ID usercount handling in background images removal.

Assuming that an ID pointer is NULL because another 'source type'
property has some specific value is utterly wrong and a gateway to
usercounting bugs.

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

M	source/blender/editors/space_view3d/view3d_edit.c

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

diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 9f8d7afd9a8..922ebe2f0f4 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -631,12 +631,8 @@ static int background_image_remove_exec(bContext *C, wmOperator *op)
   CameraBGImage *bgpic_rem = BLI_findlink(&cam->bg_images, index);
 
   if (bgpic_rem) {
-    if (bgpic_rem->source == CAM_BGIMG_SOURCE_IMAGE) {
-      id_us_min((ID *)bgpic_rem->ima);
-    }
-    else if (bgpic_rem->source == CAM_BGIMG_SOURCE_MOVIE) {
-      id_us_min((ID *)bgpic_rem->clip);
-    }
+    id_us_min((ID *)bgpic_rem->ima);
+    id_us_min((ID *)bgpic_rem->clip);
 
     BKE_camera_background_image_remove(cam, bgpic_rem);



More information about the Bf-blender-cvs mailing list