Fix #104305: Crash in node editor with large asset libraries #105773

Closed
Julian Eisel wants to merge 5 commits from JulianEisel:temp-fix-volatile-asset-handle into blender-v3.5-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

5 Commits

Author SHA1 Message Date
2228dc1092 Address review comments 2023-03-16 15:39:07 +01:00
b7c34b92bb Merge branch 'blender-v3.5-release' into temp-fix-volatile-asset-handle 2023-03-16 15:29:26 +01:00
eda6694af3 Merge branch 'blender-v3.5-release' into temp-fix-volatile-asset-handle 2023-03-16 15:10:50 +01:00
5d2c7ae405 Merge branch 'blender-v3.5-release' into temp-fix-volatile-asset-handle
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
2023-03-15 11:27:13 +01:00
c0ff16a6f7 Fix 104305: Crash in node editor with large asset libraries
Various UI code would store the `AssetHandle` in a way that turns out to
be unsafe. The file-data is part of the file browser caching system that
releases file-data when a certain maximum of items is in the cache. So
even while just iterating over the assets, earlier iterated asset
handles may become invalid. Some

For the asset-view, the fix was more involved. There we need an RNA
collection of asset-handles, because the UI list code requires that. So
we create a dummy collection and get the asset handles as needed by
index. This again meant that I had to keep the index of the collection
and the asset-list in sync, so all filtering had to be moved to the UI
list.
I tried duplicating the file-data out of the cache instead, but that
caused problems with managing the memory/ownership of the preview
images.

`AssetHandle` should be removed and replaced by `AssetRepresentation`,
but this would be an even more disruptive change (breaking API
compatibility too).

Also fixes #105535.
2023-03-14 18:51:06 +01:00