From e852533ddd3eecfd18c244fe682aa87579a48e26 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Mon, 23 Jun 2025 14:37:47 +0200 Subject: [PATCH] Fix #140781: Crash on "Adjust Pose asset" from Asset Browser See: https://projects.blender.org/blender/blender/issues/140781#issuecomment-1608861. --- source/blender/editors/animation/anim_asset_ops.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/animation/anim_asset_ops.cc b/source/blender/editors/animation/anim_asset_ops.cc index 7c70666c462..5ba4d0e5dee 100644 --- a/source/blender/editors/animation/anim_asset_ops.cc +++ b/source/blender/editors/animation/anim_asset_ops.cc @@ -638,6 +638,9 @@ static wmOperatorStatus pose_asset_modify_exec(bContext *C, wmOperator *op) { bAction *action = get_action_of_selected_asset(C); BLI_assert_msg(action, "Poll should have checked action exists"); + /* Get asset now. Asset browser might get tagged for refreshing through operations below, and not + * allow querying items from context until refreshed, see #140781. */ + const asset_system::AssetRepresentation *asset = CTX_wm_asset(C); Main *bmain = CTX_data_main(C); Object *pose_object = CTX_data_active_object(C); @@ -655,7 +658,7 @@ static wmOperatorStatus pose_asset_modify_exec(bContext *C, wmOperator *op) bke::asset_edit_id_save(*bmain, action->id, *op->reports); } - asset::refresh_asset_library_from_asset(C, *CTX_wm_asset(C)); + asset::refresh_asset_library_from_asset(C, *asset); WM_main_add_notifier(NC_ASSET | ND_ASSET_LIST | NA_EDITED, nullptr); return OPERATOR_FINISHED;