[Platformer Loading Screen Module] Loading any font causes UE4 to crash after Exiting game and Log Exit

Dear Friends at Epic,

Hourences wants me to use a font and text in the C++ starter module that I took straight from the Platformer Game

I am talking about the C++ loading screen that only ever shows once, when game is first starting, and the one which you have to add to your .uproject to get it to show up.

My loading screen implementation never used to crash on game exit, but now every time I exit Solus, all the way after all modules have been shut down, even after Log Exit,

at that point I get a crash with of course no log info because the log has closed already.

I have tracked this issue down to the fact that I recently was loading Roboto Font to display text in the C++ loading screen!

#Repro

  1. Add text to the Platformer loading screen or any of the C++ loading screen modules

  2. Run the game from commandline, not within the editor, and you will see the error I am talking about.

  3. The game will run normally, and font will show up great, but when you close the UE4 game window and exit the game, or use console->exit, UE4 will crash

#EngineContent vs Game content

As you can see in code below, I tried both Engine and Game content,

leading me to believe the crash is not related to the location of the .ttf but to some engine internals related to releasing the font when it is at that low of a level as the starting C++ Slate loading screen.

#Critical Update

I tried removing any font loading, and the crash STILL happens

(see code below for reference)

+SHorizontalBox::Slot()
		.VAlign(VAlign_Fill)
		.HAlign(HAlign_Fill)
		.Padding(FMargin(10,0,0,0))  
		[
			SNew(STextBlock)
			.Text( FString("Loading         ") )
			//NO FONT INFO SPECIFIED			
		]

so it is something fundamental to do with STextBlock and the C++ loading screen system as easily seen in Platformer game, which is where I got the code from.

Rama

#Code

Here is my C++ loading screen

The most relevant lines are toward the bottom, where I load the font.

class SSolusLoadingScreen : public SCompoundWidget
{
public:
	SLATE_BEGIN_ARGS(SSolusLoadingScreen) {}
	SLATE_END_ARGS()

	void Construct(const FArguments& InArgs)
	{
		
		FString TexturePath = SolusLoadingScreen::LoadingScreenPath;
		  
		static const FName LoadingScreenName(*TexturePath);

		//since we are not using game styles here, just load one image
		LoadingScreenBrush = MakeShareable( new FSolusLoadingScreenBrush( LoadingScreenName, SolusLoadingScreen::LoadingScreenSize ) );
		LoadingScreenBrush->Tiling = ESlateBrushTileType::Horizontal;
		
		ChildSlot
		[
			SNew(SOverlay)
			+SOverlay::Slot()
			.HAlign(HAlign_Fill)
			.VAlign(VAlign_Fill)
			[
				SNew(SImage)
				.Image(LoadingScreenBrush.Get())
				/*
				SNew(SBox)				//box method of resizing is not working
				.WidthOverride(512)
				.HeightOverride(256)
				[
					SNew(SImage)
					.Image(LoadingScreenBrush.Get())
				]
				*/
			]
			+SOverlay::Slot()
			.HAlign(HAlign_Fill)
			.VAlign(VAlign_Fill)
			[
				SNew(SHorizontalBox)
				+SHorizontalBox::Slot()
				.VAlign(VAlign_Bottom)
				.HAlign(HAlign_Left)
				.Padding(FMargin(36,0,0,60))
				[
					SNew(SHorizontalBox)
					+SHorizontalBox::Slot()
					.VAlign(VAlign_Center)
					.HAlign(HAlign_Center)
					[
						SNew(SThrobber)
						.Visibility(this, &SSolusLoadingScreen::GetLoadIndicatorVisibility)
						.Animate(SThrobber::Horizontal)
					] 
					
					+SHorizontalBox::Slot()
					.VAlign(VAlign_Fill)
					.HAlign(HAlign_Fill)
					.Padding(FMargin(10,0,0,0))  
					[
						SNew(STextBlock)
						.Text( FString("Loading         ") )
						.Font(FSlateFontInfo(FPaths::GameContentDir() / TEXT("Slate/Fonts/Roboto-Bold.ttf"), 16))
						//.Font(FSlateFontInfo(FPaths::EngineContentDir() / TEXT("Slate/Fonts/Roboto-Bold.ttf"), 16))
					]
					
				]
			]
		];
	}