Fix T51118: Outliner crash when unlinking collection
The outliner tree was not being rebuilt after unlinking a collection, and thus a dangling pointer to the collection was kept in the tree.
This commit is contained in:
parent
1a6ae0c70e
commit
1b4bd1c84e
Notes:
blender-bot
2023-02-14 07:06:04 +01:00
Referenced by issue #51118, Outliner crashes when unlinking collection
|
@ -216,6 +216,7 @@ static int collection_unlink_poll(bContext *C)
|
|||
static int collection_unlink_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
LayerCollection *lc = outliner_collection_active(C);
|
||||
SpaceOops *soops = CTX_wm_space_outliner(C);
|
||||
|
||||
if (lc == NULL) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Active element is not a collection");
|
||||
|
@ -225,6 +226,10 @@ static int collection_unlink_exec(bContext *C, wmOperator *op)
|
|||
SceneLayer *sl = CTX_data_scene_layer(C);
|
||||
BKE_collection_unlink(sl, lc);
|
||||
|
||||
if (soops) {
|
||||
outliner_cleanup_tree(soops);
|
||||
}
|
||||
|
||||
DEG_relations_tag_update(CTX_data_main(C));
|
||||
|
||||
/* TODO(sergey): Use proper flag for tagging here. */
|
||||
|
|
Loading…
Reference in New Issue