diff options
author | Hans Goudey <h.goudey@me.com> | 2021-11-05 19:19:12 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-11-05 19:19:12 +0300 |
commit | c473b2ce8bdbf8fa42d9780de035d34cb8d0e8a5 (patch) | |
tree | ae3c9eb13800a04286f74c85cb9a0b922be2c13a /source/blender/blenkernel/intern/lib_id.c | |
parent | 594ee5f160dd7cbe29d7c406299629ddfacb39ad (diff) |
Fix part of T89313: Attribute search crash during animation playback
During animation playback, data-blocks are reallocated, so storing
pointers to the resulting data is not okay. Instead, the data should
be retrieved from the context. This works when the applied search
item is the "dummy" item added for non-matches. However, it still
crashes for every other item, because the memory is owned by the
modifier value log, which has been freed by the time the exec function
runs.
The next part of the solution is to allow uiSearchItems
to own memory for the search items.
Diffstat (limited to 'source/blender/blenkernel/intern/lib_id.c')
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index bc0a8e2b9b8..cd5b266eb75 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -1375,6 +1375,20 @@ ID *BKE_libblock_find_name(struct Main *bmain, const short type, const char *nam return BLI_findstring(lb, name, offsetof(ID, name) + 2); } +struct ID *BKE_libblock_find_session_uuid(Main *bmain, + const short type, + const uint32_t session_uuid) +{ + ListBase *lb = which_libbase(bmain, type); + BLI_assert(lb != NULL); + LISTBASE_FOREACH (ID *, id, lb) { + if (id->session_uuid == session_uuid) { + return id; + } + } + return NULL; +} + /** * Sort given \a id into given \a lb list, using case-insensitive comparison of the id names. * |