diff options
author | Julian Eisel <julian@blender.org> | 2021-07-30 16:54:54 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-07-30 16:54:54 +0300 |
commit | eb2a6f454bd07442d16001e25dcf407d4e8f7533 (patch) | |
tree | 9ad9b0edcd4e6f0522dd0fb2a847108a169d8322 /source/blender/editors/interface | |
parent | 4647ffd918225452f25bd865a386e292ba7ebac8 (diff) |
Fix T90318: Dragging asset while Asset Browser is still loading crashes
This partially reverts cb0b017d8f51: We can't store the asset handle in
the drag data, because the file pointer it wraps may be freed as the
Asset Browser generates its file list.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 959716a5247..a2b25aed582 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -57,6 +57,8 @@ #include "BKE_screen.h" #include "BKE_unit.h" +#include "ED_asset.h" + #include "GPU_matrix.h" #include "GPU_state.h" @@ -6189,10 +6191,9 @@ void UI_but_drag_set_asset(uiBut *but, { wmDragAsset *asset_drag = MEM_mallocN(sizeof(*asset_drag), "wmDragAsset"); - asset_drag->asset_handle = MEM_mallocN(sizeof(asset_drag->asset_handle), - "wmDragAsset asset handle"); - *asset_drag->asset_handle = *asset; + BLI_strncpy(asset_drag->name, ED_asset_handle_get_name(asset), sizeof(asset_drag->name)); asset_drag->path = path; + asset_drag->id_type = ED_asset_handle_get_id_type(asset); asset_drag->import_type = import_type; but->dragtype = WM_DRAG_ASSET; |