From bc3aab3fa547e60d2361d5a50cdc79885bdc7355 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 21 Apr 2020 18:26:32 +0200 Subject: 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. --- source/blender/blenkernel/intern/lib_id.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/blender/blenkernel/intern/lib_id.c') 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 @@ -1087,6 +1087,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. * -- cgit v1.2.3