Fix #140781: Crash on "Adjust Pose asset" from Asset Browser

See:
https://projects.blender.org/blender/blender/issues/140781#issuecomment-1608861.
This commit is contained in:
Julian Eisel
2025-06-23 14:37:47 +02:00
parent 7519586ec0
commit e852533ddd

View File

@@ -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;