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.
This commit is contained in:
Bastien Montagne 2022-05-30 16:03:08 +02:00
parent c1277c5d25
commit e7544e3ce4
1 changed files with 2 additions and 6 deletions

View File

@ -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);