RHIUpdateTextureReference and EXCEPTION_ACCESS_VIOLATION - can't get it!

I am surely not seeing something in plain view, but a call to RHIUpdateTextureReference result is a EXCEPTION_ACCESS_VIOLATION. I have a thread that need to update a texture, so I followed the example from Petr Leontev, something like:

// this happens in a mainthread.
UTexture2D* myTexture;
myTexture = UTexture2D::CreateTransient(1024, 1024, EPixelFormat::PF_R8G8B8A8);

FTexture2DRHIRef RHITexture2D_reference;
RHITexture2D_reference = RHIAsyncCreateTexture2D(1, 1, EPixelFormat::PF_B8G8R8A8, 1, TexCreate_ShaderResource, ERHIAccess::CopyDest, &MyMipData, 1, TEXT("HHH"), Task);
// other code that starts a subthread
// this happens in a subthread.
AsyncTask(ENamedThreads::GameThread, []()
{
    ENQUEUE_RENDER_COMMAND(UpdateTextureReference)(
      [](FRHICommandListImmediate& RHICmdList)
        {
            RHIUpdateTextureReference(miaTex->TextureReference.TextureReferenceRHI, RHITexture2D_reference);
        myTexture->RefreshSamplerStates();
        }
}

Is there something so clearly wrong that I am missing it?

Wondering if this could be a lambda scope issue. Also, did you check the return of RHIAsyncCreateTexture2D? As this isn’t exactly what’s in Petr post I suspect there are some assumptions being made that don’t match his scenario/setup exactly.

Yep, the RHIAsyncCreateTexture2D return is not NULL, I checked. Good point about the scope, but in the Enqueue command is so simple I don’t know where to search.

Petr has a different approach, from gameThread calls a subthread to prepare the Texture, and then enqueue in the renderingThread.
I have a subthread, that asynchronously call the gameThread to enqueue to renderingThread.