TSharedPtr crash on exit game, traced to FWindowsApplication::ShutDownAfterError TaskbarList WindowsApplication.cpp line #234

GigasightMedia
Wed, 13 Sep 2017 20:20:33 +0000
Platform & Builds

Windows 7 64;
MS VStudio 2015;
Unreal Engine 4.17.1

I’ve been getting a crash when I exit my application, whether running PIE or standalone.

I trigger application shutdown via Kismet:

	UKismetSystemLibrary::QuitGame(this, this, EQuitPreference::Type::Quit);

Shutdown takes a long time, and ultimately freezes. I have to call up the Task Manager to get out of the game/editor window (Ctrl-Alt-Del), and I get a windows dialog informing me Unreal has crashed, and another window tracing the crash to an exception failure at Source\Runtime\Core\Public\Templates\SharedPtr.h line 824; which as it turns out is the operater* assignment for TSharedPtr.

	/**
	 * Dereference operator returns a reference to the object this shared pointer points to
	 *
	 * @return  Reference to the object
	 */
	822 FORCEINLINE typename FMakeReferenceTo<ObjectType>::Type operator*() const
	824 {
	825	check( IsValid() );    <<<<---- this check fails
	826	return Object;
	827}

I painstakingly pored over my entire codebase and removed all instances of TSharedPtr in the hopes of eliminating the crash, and then reinstating them until I found the issue; but when debugging I’m not led to anywhere in my code, I get a nullptr exception in Source\Runtime\Core\Private\Windows\WindowsApplication.cpp, line 234:

228 void FWindowsApplication::ShutDownAfterError()
229 {
230	// Restore accessibility shortcuts and remove the saved state from the .ini
231	AllowAccessibilityShortcutKeys(true);
232	GConfig->EmptySection(TEXT("WindowsApplication.Accessibility"), GEngineIni);
233
234	TaskbarList = nullptr;   <<<<<<< crashes here; nullptr exception
235}

TaskbarList is, in fact, a TSharedPtr; declared at Source\Runtime\Core\Public\Windows\WindowsApplication.h line 499:

	499 TSharedPtr<FTaskbarList> TaskbarList;

This is a showstopper for me, and I’m at a loss as to how to continue.

Any ideas?

8 posts - 3 participants