[C++] UMG Widgets are making UE crash

So I have created some derived classes from UOverlay, UHorizontalBox.
In these classes I have a function called Setup that takes some arguments and looks like this:

    void UMHUDOverlay::Setup(UMInventoryComponent* inventoryComponent)
    {
    	UMInventoryDisplay* hotBarDisplay = NewObject<UMInventoryDisplay>(this);
    
    	hotBarDisplay->Setup(inventoryComponent->GetHotBar());
    
    	UOverlaySlot* overlaySlot = AddChildToOverlay(hotBarDisplay);
    }

I call this function in my PlayerController class (in BeginPlay).
Like this:

    void MPlayerController::BeginPlay()
    {
    	test = NewObject<UMHUDOverlay>(this);
    	test->Setup(Cast<AMCharacter>(GetPawn())->GetInventoryComponent());
    
    	GEngine->GameViewport->AddViewportWidgetContent(test->TakeWidget());

        //....
    }

Am I doing something wrong because when the game starts everything is fine
and then after about 1 minute an exception is thrown. (Also this exception can be different each time is crashes)

The call stack you shown tells nothing because you missing PDB files to translate it to proper code line positions. I suspect you tuning lacuher editor, the PSB files are optional on it and you need to install it in launcher, click arrow near button below version of your engine and click “Options” and install “Editor symbols for debugging”. This is essential if you doing any C++ code otherwise oyu won’t know where crash happened in engine or editor code

If enigne crash it self due ot detected error (in most cases assert fail) you will have info in logs at Saved/Logs in your project directory. It usually leaves failed bool condition, but sometimes shows proper error message. In those cases debuging is not needed