From 990406e1ff9371a8c896b71171caa876cfdff2f6 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Tue, 15 Dec 2020 16:58:30 +0100 Subject: Fix crash when deleting/renaming asset library while it's visible Storing the asset library reference by name wasn't a good idea, I thought it would work with a careful fallback, but it's easier to just use the index instead. So change to using indices, make sure fallback methods work reliable and make sure the file list is updated when asset libraries are removed. I added a new notifier type for the latter, I prefer not using file notifiers in asset-library/preferences code. We have more than enough values for notifiers left. --- source/blender/makesdna/DNA_space_types.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source/blender/makesdna/DNA_space_types.h') diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index e07f085d356..4161faca386 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -673,12 +673,13 @@ typedef enum eSpaceSeq_OverlayType { */ typedef struct FileSelectAssetLibraryUID { short type; - char _pad[6]; + char _pad[2]; /** - * If showing a custom asset library (#FILE_ASSET_LIBRARY_CUSTOM), this name has to be set to - * define which. Can be empty otherwise. + * If showing a custom asset library (#FILE_ASSET_LIBRARY_CUSTOM), this is the index of the + * #bUserAssetLibrary within #UserDef.asset_libraries. + * Should be ignored otherwise (but better set to -1 then, for sanity and debugging). */ - char custom_library_identifier[64]; /* MAX_NAME */ + int custom_library_index; } FileSelectAssetLibraryUID; /* Config and Input for File Selector */ -- cgit v1.2.3