Fix T53052: ID decrement error when deleting a scene, either python or GUI.
User count of scenes was inconsistant, screens only have 'user_one' kind of owning over scenes, which means they shall never increment or decrement their real user count. And usually, scenes have no real user at all.
This commit is contained in:
@@ -290,7 +290,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
|
||||
ListBase rl, rv;
|
||||
|
||||
sce_copy = BKE_scene_add(bmain, sce->id.name + 2);
|
||||
|
||||
|
||||
rl = sce_copy->r.layers;
|
||||
rv = sce_copy->r.views;
|
||||
curvemapping_free_data(&sce_copy->r.mblur_shutter_curve);
|
||||
@@ -387,6 +387,8 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
|
||||
}
|
||||
else {
|
||||
BKE_id_copy_ex(bmain, (ID *)sce, (ID **)&sce_copy, LIB_ID_COPY_ACTIONS, false);
|
||||
id_us_min(&sce_copy->id);
|
||||
id_us_ensure_real(&sce_copy->id);
|
||||
|
||||
/* Extra actions, most notably SCE_FULL_COPY also duplicates several 'children' datablocks... */
|
||||
|
||||
|
||||
@@ -1763,7 +1763,10 @@ bool ED_screen_delete_scene(bContext *C, Scene *scene)
|
||||
|
||||
BKE_libblock_remap(bmain, scene, newscene, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_NEVER_NULL_USAGE);
|
||||
|
||||
BKE_libblock_free_us(bmain, scene);
|
||||
id_us_clear_real(&scene->id);
|
||||
if (scene->id.us == 0) {
|
||||
BKE_libblock_free(bmain, scene);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user