-1

I am currently working in a multithreaded environment where I need to pass a reference as a global variable. The basic structure would look something like this:

Worker::JoyInit(TSet<Worker>& w)

{
    UE_LOG(LogTemp, Warning, TEXT("w.num() = %d"), w.Num());
}

But the editor crashes every time I try to play it! I am not very comfortable with pointers so any quick advice would be greatly appreciated I am calling JoyInit like so:

Worker::JoyInit(*queue);

and queue is defined as:

TSet<Worker>* queue = nullptr;
Carl Newman
  • 11
  • 1
  • 3

1 Answers1

0

Ok so I figured out what I did wrong. My method call and initialization of queue variable were wrong. I changed the code to:

Worker::JoyInit(queue);

and

TSet<Worker> queue;

and it compiles.

Carl Newman
  • 11
  • 1
  • 3