Crash in FUniformExpressionSet::FillUniformBuffer trying access deleted UTextureCollection

This crash is occurring because the UTextureCollection used by the material is being freed before the material. The material was already queued for renderering and tries to reference the now deleted UTextureCollection. FMaterialCachedExpressionData::AddReferencedObjects does not add references to ReferencedTextureCollections. Just need to add that call. Attached is a patch file with the change.

Steps to Reproduce
Not easy to recreate a test case, but the code change is fairly simple.

Hello [mention removed]​

Thank you for reaching out and bringing this issue to our attention.

Could you provide a minimal project that reproduces the issue, or a description with the required steps to reach the shared crash?

Let me know.

All the best,

[mention removed]​

Materials using texture collections in vanilla unreal 5.5.4 do not cook successfully. Our code base already has many fixes for texture collections. Attached to the original report is a patch file with the needed fix. The fix is straight forward and should be fairly obvious to an engineer that knows that system.

Hello [mention removed]​

Thank you again for reaching out, reporting this issue, and for the proposed fix.

I’ve made a JIRA report to be added to the Unreal issue tracker website (https://issues.unrealengine.com).

Please note that Epic ultimately determines whether the issue will be made publicly accessible, and the process can take a few days; therefore, the tracking link may not be immediately accessible.

Once available, you will be able to track the resolution at Unreal Engine Issues and Bug Tracker (UE\-291472)

I’ll close the case, but feel free to reply if you have anything else to add.

All the best,

[mention removed]​