diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-08 20:45:57 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-08 20:54:52 +0300 |
commit | 0e3d1eee15b7b6dadaddaa7f1f4b8d30b80e6792 (patch) | |
tree | 09947d627668f17dcf3f042a13d956a46653e0db /source/blender/blenloader/BLO_readfile.h | |
parent | 6ba8e71fa2890ec36de6f5012414ff40e5e4b23a (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/blenloader/BLO_readfile.h')
-rw-r--r-- | source/blender/blenloader/BLO_readfile.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 90f46ccd49d..e8bfeecb305 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -144,7 +144,7 @@ void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char /* internal function but we need to expose it */ void blo_lib_link_restore( - struct Main *newmain, struct wmWindowManager *curwm, + struct Main *oldmain, struct Main *newmain, struct wmWindowManager *curwm, struct Scene *curscene, struct ViewLayer *cur_render_layer); typedef void (*BLOExpandDoitCallback) (void *fdhandle, struct Main *mainvar, void *idv); |