diff options
author | Bastien Montagne <bastien@blender.org> | 2020-04-21 19:26:32 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-04-21 19:26:32 +0300 |
commit | bc3aab3fa547e60d2361d5a50cdc79885bdc7355 (patch) | |
tree | a445f1e51b612b8ecd3d5a40045e56ca0e5fb9b4 /source/blender/blenkernel/intern/lib_id.c | |
parent | b4993a903255bd589cdb7afe232cec9f80ca49dc (diff) |
Fix T75893: Undo causes crash with "Load UI" disabled.
We need to re-generate a new session uuid for the UI-related data-blocks
that are kept across file reading, when load UI is disabled. Otherwise
there will be several IDs with same uuid, which is an ensured way to
crash in new undo code.
Diffstat (limited to 'source/blender/blenkernel/intern/lib_id.c')
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index 80f29a55b28..d1337620de8 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -1088,6 +1088,18 @@ void BKE_lib_libblock_session_uuid_ensure(ID *id) } /** + * Re-generate a new session-wise uuid for the given \a id. + * + * \warning This has a very specific use-case (to handle UI-related data-blocks that are kept + * across new file reading, when we do keep existing UI). No other usage is expected currently. + */ +void BKE_lib_libblock_session_uuid_renew(ID *id) +{ + id->session_uuid = MAIN_ID_SESSION_UUID_UNSET; + BKE_lib_libblock_session_uuid_ensure(id); +} + +/** * Generic helper to create a new empty data-block of given type in given \a bmain database. * * \param name: can be NULL, in which case we get default name for this ID type. |