Download

Cannot Queue Expression Cache - Garbage Collection

Hey Guys, I have a problem where my game crash when I call the SetImage() function from SImage.h as seen at line 11 below in the code snippet. The error is specifically. “Cannot queue the expression cache when it is about to be deleted.” MaterialShared.cpp [Line 2410} I believe this is pending GC? can anyone enlighten me?

My Slate widget inherits from SCompoundWidget, the error only ocurs when I call setimage()

Thank you

header.h


TSharedPtr<class SImage> PawnViewImage;

Source.cpp


1. UMaterialInterface* PawnViewMatInst = LoadObject<UMaterialInterface>(NULL, TEXT("MaterialInstanceConstant'/Game/Blueprints/UserWidgets/Minimap/Material/EnemyViewMat_Inst.EnemyViewMat_Inst'"));
2.
3. UMaterialInstanceDynamic* PawnViewMatDynamic = UMaterialInstanceDynamic::Create(EnemyViewMatInst, nullptr);
4.
5. FSlateBrush* PawnViewBrush = new FSlateBrush();
6.
7. PawnViewBrush->ImageSize = FVector2D(210.f, 210.f);
8. PawnViewBrush->DrawAs = ESlateBrushDrawType::Image;
9.
10.PawnViewBrush->SetResourceObject(EnemyViewMatDynamic);
11.PawnViewImage->SetImage(EnemyViewBrush);
12.PawnViewImage->SetColorAndOpacity(FLinearColor(0.3f, 1.f, 0.32f, 0.4f));

ChildSlot


+ SOverlay::Slot()
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
[
SAssignNew(PawnViewImage, SImage)
]


MaterialShared.cpp snippet


void FMaterialRenderProxy::InvalidateUniformExpressionCache(bool bRecreateUniformBuffer)
{
check(IsInRenderingThread());

[Line 2410]
if (HasVirtualTextureCallbacks)
{
GetRendererModule().RemoveAllVirtualTextureProducerDestroyedCallbacks(this);
HasVirtualTextureCallbacks = false;
}