Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-09-22 15:34:59 +0300
committerBastien Montagne <bastien@blender.org>2021-09-22 15:37:00 +0300
commit9add7c35cc6818b28842dd1bcdd3081d35d7623b (patch)
tree4a2c48054760d222ac82d74dc44caf13d540893b
parent2526a355bcae7292d6945903def69f982f88990d (diff)
Fix (unreported) crash in outliner after recent changes to ID management core code.
Outliner tree building code abuse the `ID.newid` pointer to store non-ID data. While this is bad and should be fixed at some point, for the time being at the very least do not use ID BKE API to deal with this pointer in that specific case, this needs its own proper code.
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index c5ec656080a..5427ae31ac3 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1864,6 +1864,15 @@ static void outliner_filter_tree(SpaceOutliner *space_outliner, ViewLayer *view_
space_outliner, view_layer, &space_outliner->tree, search_string, exclude_filter);
}
+static void outliner_clear_newid_from_main(Main *bmain)
+{
+ ID *id_iter;
+ FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
+ id_iter->newid = NULL;
+ }
+ FOREACH_MAIN_ID_END;
+}
+
/* ======================================================= */
/* Main Tree Building API */
@@ -1926,5 +1935,7 @@ void outliner_build_tree(Main *mainvar,
outliner_filter_tree(space_outliner, view_layer);
outliner_restore_scrolling_position(space_outliner, region, &focus);
- BKE_main_id_newptr_and_tag_clear(mainvar);
+ /* `ID.newid` pointer is abused when building tree, DO NOT call #BKE_main_id_newptr_and_tag_clear
+ * as this expects valid IDs in this pointer, not random unknown data. */
+ outliner_clear_newid_from_main(mainvar);
}