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/blenkernel/intern/blendfile.c | |
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/blenkernel/intern/blendfile.c')
-rw-r--r-- | source/blender/blenkernel/intern/blendfile.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index 34cc0a69c2e..51c5b52d088 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -203,7 +203,7 @@ static void setup_app_data( } /* BKE_blender_globals_clear will free G_MAIN, here we can still restore pointers */ - blo_lib_link_restore(bfd->main, CTX_wm_manager(C), curscene, cur_view_layer); + blo_lib_link_restore(bmain, bfd->main, CTX_wm_manager(C), curscene, cur_view_layer); if (win) { curscene = win->scene; } |