Setting up loading screen via MoviePlayer causes crash

I’ve been trying to set up a loading screen in C++, and I now have the following in a BeginLoadingScreen function in my GameInstance class, where it’s called before any joining/hosting functions execute. This definitely works as expected - the test/default loading screen appears and then disappears when loading has concluded.

void USpaceGameInstance::BeginLoadingScreen()
{
	FLoadingScreenAttributes LoadingScreen;
	LoadingScreen.bAutoCompleteWhenLoadingCompletes = true;

	LoadingScreen.WidgetLoadingScreen = FLoadingScreenAttributes::NewTestLoadingScreenWidget();

	GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
}

However, with the above code, if I later quit back to the menu and then quit my game, I get an access violation that the call stack suggests starts from FDefaultGameMoviePlayer’s destructor. If I don’t include the last line (where I call ‘SetupLoadingScreen’ on the movie player), this crash does not occur.

Call Stack:

	FlightPrototype-Win64-DebugGame.exe!StaticFailDebug(const wchar_t * Error, const char * File, int Line, const wchar_t * Description, bool bIsEnsure) Line 167	C++
 	FlightPrototype-Win64-DebugGame.exe!FDebug::AssertFailed(const char * Expr, const char * File, int Line, const wchar_t * Format, ...) Line 220	C++
 	FlightPrototype-Win64-DebugGame.exe!FICUBreakIterator::~FICUBreakIterator() Line 72	C++
 	[External Code]	
 	FlightPrototype-Win64-DebugGame.exe!FTextLayout::~FTextLayout() Line 1722	C++
 	[External Code]	
 	FlightPrototype-Win64-DebugGame.exe!SharedPointerInternals::DestroyObject<FTextBlockLayout>(void * Object) Line 278	C++
 	[External Code]	
 	FlightPrototype-Win64-DebugGame.exe!TIndirectArray<SBoxPanel::FSlot,FDefaultAllocator>::DestructAndFreeItems() Line 2383	C++
 	[External Code]	
 	FlightPrototype-Win64-DebugGame.exe!TIndirectArray<SOverlay::FOverlaySlot,FDefaultAllocator>::DestructAndFreeItems() Line 2383	C++
 	FlightPrototype-Win64-DebugGame.exe!SOverlay::~SOverlay() Line 82	C++
 	[External Code]	
 	FlightPrototype-Win64-DebugGame.exe!FDefaultGameMoviePlayer::~FDefaultGameMoviePlayer() Line 39	C++
 	[External Code]	

As a result of the above, I’m questioning if this is the appropriate method for creating a loading screen. Any advice would be appreciated.

Thanks.

Is anyone using the MoviePlayer for splash screens and loading? Info seems pretty thin.

We do use it. However we had the same problem and it seems there is some problem in destroying text widgets that are created by that special “Movie Player Slate Thread”. For now we removed all text widgets but that is of course far from perfect.

Marc

See also here: How do I make a Loading Screen? - World Creation - Unreal Engine Forums

I fixed the problem and submitted a pull request that you could fetch: https://github.com/EpicGames/UnrealEngine/pull/799

Marc