Crash in FD3D11DynamicRHI::RHISetShaderSampler

Hello,

I render into Canvas (AHUD class), using DrawItem calls, filling manually triangles. Don’t do much more than that.

Eventually (5-10 seconds later), if I don’t touch an application, it will crash at the topic function:



void FD3D11DynamicRHI::RHISetShaderSampler(FPixelShaderRHIParamRef PixelShaderRHI,uint32 SamplerIndex,FSamplerStateRHIParamRef NewStateRHI)
{
	VALIDATE_BOUND_SHADER(PixelShaderRHI);

	DYNAMIC_CAST_D3D11RESOURCE(PixelShader,PixelShader);
	DYNAMIC_CAST_D3D11RESOURCE(SamplerState,NewState);

	ID3D11SamplerState* StateResource = **NewState->Resource;**
	StateCache.SetSamplerState<SF_Pixel>(StateResource, SamplerIndex);
}


NewState in the function will be NULL.

It crashes there mostly independently of what screen I am on, or do I touch application or not.
What would you recommend me to dig in, what this crash may symbolize that I do wrong?

UPD: this happens because texture was recycled, but still Engine attempts to render it next frame. In my BitmapManager every texture I create, I say - AddToRoot. On release I remove from root. Proper ref-counter is embedded.

Quick question, if I attempt to load same texture several times, will it return me same UTexture pointer?

Anyways, I found the reason. Last question was a guiding one, giving me hint that I indeed tried to draw released,and previously unpinned UTexture’s.