How to see what lambda? in crash reporter

So I am having troubles with crashing, I am using lambda’s and the crash reprot always has this: UE4Editor_CoverGeneration!UE4Function_Private::TFunctionRefCaller

But how do I know what lambda? I also use multithreading and lambda’s together so some weird stuff can happen with debugging.

TFunctionRef is a reference type that does not take an owning copy of any lambda with which it is constructed, unlike TFunction. It sounds like (if the crash is happening trying to invoke the lambda, rather than inside the lamda itself) that your TFunctionRef has outlived the lambda that it was created with. In general, if you’re passing a lambda to something which will be called at a later time (common in multithreading environments), you should use TFunction.

TFunctionRef is not designed for in examples like the following:

// Bad - lambda only exists for the construction of MyFunction
TFunctionRef<void()> MyFunction([]{ /* lambda body */ });
// potential crash - constructed lambda is out of scope

// ----------------------------------------------------------------------------------------

void GetCallback(TFunctionRef<void()>& OutCallback)
  auto MyCallback = []{ /* lambda body */ };
  OutCallback = MyCallback;

TFunctionRef<void> Callback;
// potential crash - MyCallback is only valid inside the body of GetCallback

Still no one?

I know this is a long time ago, I should probably note that all lambda’s I use are AsyncTask()s for accessing the game thread, how would that work then?

AsyncTask uses TFunction, so you can safely pass a lambda straight in:

       //... Game thread logic


auto GTTask = []{
   //... Game thread logic
AsyncTask(ENamedThreads::GameThread, GTTask);

You should take care to ensure that anything you capture into the lambda is either captured by value, and/or is still valid when it is read on the game thread however.