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 <montagne29@wanadoo.fr>2019-02-08 20:45:57 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-02-08 20:54:52 +0300
commit0e3d1eee15b7b6dadaddaa7f1f4b8d30b80e6792 (patch)
tree09947d627668f17dcf3f042a13d956a46653e0db /source/blender/blenkernel/BKE_library_idmap.h
parent6ba8e71fa2890ec36de6f5012414ff40e5e4b23a (diff)
Fix (unreported) crash when undoing after ID deletion.
Yes, we do can undo an ID deletion now. However, this requires extra care in UI 'remapping' to new IDs step (when undoing, we do not fully reload the UI from saved .blend). Otherwise, new UI (i.e. one from saved .blend file) might reference IDs that where freed in old bmain (the one before the undo), we cannot use those to get ID name then, that would be a nasty use-after-free! To prevent this, we generate a GSet of all valid ID pointers at that time (i.e. those found in both old and new Main's), and ensure any ID we try to remap by its name is in that GSet. Otherwise, there is no possible remapping, just return NULL.
Diffstat (limited to 'source/blender/blenkernel/BKE_library_idmap.h')
-rw-r--r--source/blender/blenkernel/BKE_library_idmap.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_library_idmap.h b/source/blender/blenkernel/BKE_library_idmap.h
index ec814ac73de..0e16aa15984 100644
--- a/source/blender/blenkernel/BKE_library_idmap.h
+++ b/source/blender/blenkernel/BKE_library_idmap.h
@@ -26,8 +26,10 @@ struct IDNameLib_Map;
struct Main;
struct IDNameLib_Map *BKE_main_idmap_create(
- struct Main *bmain)
- ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+ struct Main *bmain,
+ const bool create_valid_ids_set,
+ struct Main *old_bmain)
+ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
void BKE_main_idmap_destroy(
struct IDNameLib_Map *id_typemap)
ATTR_NONNULL();