Random crashes and weird behaviour in custom gametype

Engine version: 4.10.1

Normal behaviour
When the game is functioning normally the expected behaviour is as follows:
The game creates a bunch of random questions from a json file with a correct answer and wrong answers.
Then a word is shown on screen, which dissapears after some time at which point a collectible spawner gets
enabled which will spawn collectibles which represent one correct and multiple incorrect answers which the
user will have to fly into to collect.

The problem
There are two things that go wrong however, sometimes both in the same game session:

  1. Collectibles get spawned without the data that makes them represent an answer
  2. The entire game/editor crashes without anything in the crashdump window

The problems are more likely to occur the longer the game has been running, including time spent having
the game’s execution on paused in PIE.
When it crashes it can do so at any point (before the level has started, while playing, and after the level
has ended).

All of the problems happen in the same way on multiple PC’s (at different locations) and on an Android phone (Samsung Galaxy S3)
so it’s probably not hardware related.

Using Visual Studio I’ve gotten exceptions at three different points in the code, it seems to be completely
random at which of those points it will crash.

File: UserWidget.cpp
Line: 554
Exception: Exception thrown at 0x00007FFA43F808D6 (UE4Editor-UMG.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
Remarks: UUserWidget* Widget isn’t null at this point
Call stack:


>	UE4Editor-UMG.dll!UUserWidget::IsInViewport() Line 554	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!ASjorsGameMode::SetWidgetEnabled(bool Enabled, UUserWidget * Widget) Line 394	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!ASjorsGameMode::Self_OnStateChanged() Line 272	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!ASjorsGameMode::execSelf_OnStateChanged(FFrame & Stack, void * const Z_Param__Result) Line 25	C++
 	UE4Editor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 4198	C++
 	UE4Editor-CoreUObject.dll!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 1046	C++
 	UE4Editor-Engine.dll!AActor::ProcessEvent(UFunction * Function, void * Parameters) Line 580	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!TScriptDelegate<FWeakObjectPtr>::ProcessDelegate<UObject>(void * Parameters) Line 235	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!TMulticastScriptDelegate<FWeakObjectPtr>::ProcessMulticastDelegate<UObject>(void * Parameters) Line 459	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!ASjorsGameMode::SetState(EGameModeState NewState) Line 498	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!ASjorsGameMode::NextQuestion() Line 516	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!TBaseUObjectMethodDelegateInstance<0,ASjorsGameMode,TTypeWrapper<void> __cdecl(void)>::Execute() Line 682	C++
 	UE4Editor-Engine.dll!FTimerUnifiedDelegate::Execute() Line 38	C++
 	UE4Editor-Engine.dll!FTimerManager::Tick(float DeltaTime) Line 439	C++
 	UE4Editor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1212	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1347	C++
 	UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 361	C++
 	UE4Editor.exe!FEngineLoop::Tick() Line 2427	C++
 	UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 142	C++
 	UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 189	C++
 	[External Code]	

File: ScriptCore.cpp
Line: 439
Exception: Exception thrown at 0x00007FFA479914A8 (UE4Editor-CoreUObject.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
Call stack:


>	UE4Editor-CoreUObject.dll!UObject::CallFunction(FFrame & Stack, void * const Z_Param__Result, UFunction * Function) Line 439	C++
 	UE4Editor-CoreUObject.dll!UObject::ProcessContextOpcode(FFrame & Stack, void * const Z_Param__Result, bool bCanFailSilently) Line 1755	C++
 	UE4Editor-CoreUObject.dll!UObject::execLetBool(FFrame & Stack, void * const Z_Param__Result) Line 1670	C++
 	UE4Editor-CoreUObject.dll!UObject::ProcessInternal(FFrame & Stack, void * const Z_Param__Result) Line 698	C++
 	UE4Editor-CoreUObject.dll!UObject::CallFunction(FFrame & Stack, void * const Z_Param__Result, UFunction * Function) Line 608	C++
 	UE4Editor-CoreUObject.dll!UObject::execVirtualFunction(FFrame & Stack, void * const Z_Param__Result) Line 1842	C++
 	UE4Editor-CoreUObject.dll!UObject::ProcessInternal(FFrame & Stack, void * const Z_Param__Result) Line 698	C++
 	UE4Editor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 4198	C++
 	UE4Editor-CoreUObject.dll!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 1053	C++
 	UE4Editor-Engine.dll!AActor::ProcessEvent(UFunction * Function, void * Parameters) Line 580	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!ACollectible::SetMetaData(UCollectibleMetaData * MetaData) Line 79	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!ACollectibleSpawner::SpawnCollectible(UCollectibleMetaData * MetaData) Line 167	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!ACollectibleSpawner::TickSpawnTimer(float DeltaTime) Line 91	C++
 	UE4Editor-Sjors-Win64-DebugGame.dll!ACollectibleSpawner::Tick(float DeltaTime) Line 79	C++
 	UE4Editor-Engine.dll!AActor::TickActor(float DeltaSeconds, ELevelTick TickType, FActorTickFunction & ThisTickFunction) Line 730	C++
 	UE4Editor-Engine.dll!FActorTickFunction::ExecuteTick(float DeltaTime, ELevelTick TickType, ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 107	C++
 	UE4Editor-Engine.dll!FTickFunctionTask::DoTask(ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 141	C++
 	UE4Editor-Engine.dll!TGraphTask<FTickFunctionTask>::ExecuteTask(TArray<FBaseGraphTask *,FDefaultAllocator> & NewTasks, ENamedThreads::Type CurrentThread) Line 779	C++
 	UE4Editor-Core.dll!FTaskThread::ProcessTasks(int QueueIndex, bool bAllowStall) Line 539	C++
 	UE4Editor-Core.dll!FTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 340	C++
 	UE4Editor-Core.dll!FTaskGraphImplementation::WaitUntilTasksComplete(const TArray<TRefCountPtr<FGraphEvent>,TInlineAllocator<4,FDefaultAllocator> > & Tasks, ENamedThreads::Type CurrentThreadIfKnown) Line 1140	C++
 	UE4Editor-Engine.dll!FTaskGraphInterface::WaitUntilTaskCompletes(const TRefCountPtr<FGraphEvent> & Task, ENamedThreads::Type CurrentThreadIfKnown) Line 212	C++
 	UE4Editor-Engine.dll!FTickTaskSequencer::ReleaseTickGroup(ETickingGroup WorldTickGroup, bool bBlockTillComplete) Line 285	C++
 	UE4Editor-Engine.dll!FTickTaskManager::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 1206	C++
 	UE4Editor-Engine.dll!UWorld::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 701	C++
 	UE4Editor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1150	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1347	C++
 	UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 361	C++
 	UE4Editor.exe!FEngineLoop::Tick() Line 2427	C++
 	UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 142	C++
 	UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 189	C++
 	[External Code]	

I’ve also had it crash inside of the garbage collector, but haven’t been able to reproduce that one.

When I continue the code at the breakpoint (triggered by the exception) it simply throws even more similar exceptions at me all with different addresses.

The log file
(/Saved/Logs)
(it really gets cut off at the end, this is the entire file)


[2016.01.08-09.32.02:735]  0]Log file open, 01/08/16 10:32:02
[2016.01.08-09.32.02:735]  0]LogInit:Display: Running engine for game: Sjors
[2016.01.08-09.32.02:735]  0]LogPlatformFile: Not using cached read wrapper
[2016.01.08-09.32.02:735]  0]LogInit:Display: RandInit(-445707807) SRandInit(-445707804).
[2016.01.08-09.32.02:735]  0]LogTaskGraph: Started task graph with 4 named threads and 7 total threads.
[2016.01.08-09.32.02:735]  0]LogStats: Stats thread started at 0.142239
[2016.01.08-09.32.02:735]  0]LogInit: Version: 4.10.1-2791327+++depot+UE4-Releases+4.10
[2016.01.08-09.32.02:735]  0]LogInit: API Version: 2758231
[2016.01.08-09.32.02:735]  0]LogInit: Compiled (64-bit): Dec  4 2015 19:44:40
[2016.01.08-09.32.02:735]  0]LogInit: Compiled with Visual C++: 19.00.23026.00
[2016.01.08-09.32.02:735]  0]LogInit: Build Configuration: DebugGame
[2016.01.08-09.32.02:735]  0]LogInit: Branch Name: ++depot+UE4-Releases+4.10
[2016.01.08-09.32.02:735]  0]LogInit: Command line:  -debug
[2016.01.08-09.32.02:735]  0]LogInit: Base directory: C:/Program Files (x86)/Epic Games/4.10/Engine/Binaries/Win64/
[2016.01.08-09.32.02:736]  0]LogInit: Rocket: 1
[2016.01.08-09.32.02:749]  0]LogInit: Using libcurl 7.41.0
[2016.01.08-09.32.02:749]  0]LogInit:  - built for x86_64-pc-win32
[2016.01.08-09.32.02:749]  0]LogInit:  - supports SSL with WinSSL
[2016.01.08-09.32.02:749]  0]LogInit:  - other features:
[2016.01.08-09.32.02:749]  0]LogInit:      CURL_VERSION_SSL
[2016.01.08-09.32.02:749]  0]LogInit:      CURL_VERSION_IPV6
[2016.01.08-09.32.02:749]  0]LogInit:      CURL_VERSION_ASYNCHDNS
[2016.01.08-09.32.02:749]  0]LogInit:      CURL_VERSION_LARGEFILE
[2016.01.08-09.32.02:749]  0]LogInit:      CURL_VERSION_IDN
[2016.01.08-09.32.02:749]  0]LogInit:  CurlRequestOptions (configurable via config and command line):
[2016.01.08-09.32.02:750]  0]LogInit:  - bVerifyPeer = true  - Libcurl will verify peer certificate
[2016.01.08-09.32.02:750]  0]LogInit:  - bUseHttpProxy = false  - Libcurl will NOT use HTTP proxy
[2016.01.08-09.32.02:750]  0]LogInit:  - bDontReuseConnections = false  - Libcurl will reuse connections
[2016.01.08-09.32.02:750]  0]LogInit:  - CertBundlePath = nullptr  - Libcurl will use whatever was configured at build time.
[2016.01.08-09.32.02:771]  0]LogInit: Presizing for 0 objects not considered by GC, pre-allocating 0 bytes.
[2016.01.08-09.32.02:776]  0]LogInit: Object subsystem initialized
[2016.01.08-09.32.02:777]  0]LogInit: Selected Device Profile: [Windows]
[2016.01.08-09.32.02:777]  0]LogInit: Applying CVar settings loaded from the selected device profile: [Windows]
[2016.01.08-09.32.02:784]  0]LogInit: Computer: DESKTOP-6O3S4HM
[2016.01.08-09.32.02:784]  0]LogInit: User: Human
[2016.01.08-09.32.02:784]  0]LogInit: CPU Page size=4096, Cores=4
[2016.01.08-09.32.02:784]  0]LogInit: High frequency timer resolution =3.420548 MHz
[2016.01.08-09.32.02:784]  0]LogMemory: Memory total: Physical=16.0GB (16GB approx)
[2016.01.08-09.32.02:784]  0]LogMemory: Platform Memory Stats for Windows
[2016.01.08-09.32.02:784]  0]LogMemory: Process Physical Memory: 56.89 MB used, 56.89 MB peak
[2016.01.08-09.32.02:784]  0]LogMemory: Process Virtual Memory: 59.17 MB used, 59.17 MB peak
[2016.01.08-09.32.02:784]  0]LogMemory: Physical Memory: 6831.08 MB used, 16360.76 MB total
[2016.01.08-09.32.02:784]  0]LogMemory: Virtual Memory: 385.68 MB used, 134217728.00 MB total
[2016.01.08-09.32.03:377]  0]LogTextLocalizationManager: No specific translations for ('en-US') exist, so ('en') translations will be used.
[2016.01.08-09.32.03:681]  0]LogD3D11RHI: Found D3D11 adapter 0: NVIDIA GeForce GTX 660   (Feature Level 11_0)
[2016.01.08-09.32.03:681]  0]LogD3D11RHI: Adapter has 1988MB of dedicated video memory, 0MB of dedicated system memory, and 8180MB of shared system memory, 1 output[s]
[2016.01.08-09.32.03:686]  0]LogD3D11RHI: Found D3D11 adapter 1: Microsoft Basic Render Driver (Feature Level 11_0)
[2016.01.08-09.32.03:686]  0]LogD3D11RHI: Adapter has 0MB of dedicated video memory, 0MB of dedicated system memory, and 8180MB of shared system memory, 0 output[s]
[2016.01.08-09.32.03:686]  0]LogD3D11RHI: Chosen D3D11 Adapter Id = 0
[2016.01.08-09.32.03:690]  0]LogD3D11RHI: !Direct3DDevice
[2016.01.08-09.32.03:690]  0]LogRHI: Texture pool is 1361 MB (70% of 1945 MB)
[2016.01.08-09.32.03:705]  0]LogD3D11RHI: Async texture creation enabled
[2016.01.08-09.32.03:722]  0]LogShaderCompilers: Guid format shader working directory is 25 characters bigger than the processId version (E:/Projects/UE4/Sjors/Intermediate/Shaders/WorkingDirectory/7216/).
[2016.01.08-09.32.03:723]  0]LogShaderCompilers: Cleaned the shader compiler working directory 'C:/Users/Human/AppData/Local/Temp/UnrealShaderWorkingDir/A09E3ED7419F4094F476679BD4C5CD51/'.
[2016.01.08-09.32.03:723]  0]LogShaderCompilers:Display: Using Local Shader Compiler.
[2016.01.08-09.32.04:426]  0]LogTemp:Display: Loaded TP AllDesktopTargetPlatform
[2016.01.08-09.32.04:437]  0]LogTemp:Display: Loaded TP WindowsClientTargetPlatform
[2016.01.08-09.32.04:447]  0]LogTemp:Display: Loaded TP WindowsNoEditorTargetPlatform
[2016.01.08-09.32.04:456]  0]LogTemp:Display: Loaded TP WindowsServerTargetPlatform
[2016.01.08-09.32.04:465]  0]LogTemp:Display: Loaded TP WindowsTargetPlatform
[2016.01.08-09.32.04:470]  0]LogTemp:Display: Loaded TP AndroidTargetPlatform
[2016.01.08-09.32.04:475]  0]LogTemp:Display: Loaded TP Android_ASTCTargetPlatform
[2016.01.08-09.32.04:481]  0]LogTemp:Display: Loaded TP Android_ATCTargetPlatform
[2016.01.08-09.32.04:486]  0]LogTemp:Display: Loaded TP Android_DXTTargetPlatform
[2016.01.08-09.32.04:491]  0]LogTemp:Display: Loaded TP Android_ETC1TargetPlatform
[2016.01.08-09.32.04:496]  0]LogTemp:Display: Loaded TP Android_ETC2TargetPlatform
[2016.01.08-09.32.04:506]  0]LogTemp:Display: Loaded TP Android_MultiTargetPlatform
[2016.01.08-09.32.04:506]  0]LogTemp:Display: Loaded TP Android_PVRTCTargetPlatform
[2016.01.08-09.32.04:509]  0]LogTemp:Display: Loaded TP HTML5TargetPlatform
[2016.01.08-09.32.04:535]  0]LogTemp:Display: Loaded TP IOSTargetPlatform
[2016.01.08-09.32.04:540]  0]LogTemp:Display: Loaded TP LinuxNoEditorTargetPlatform
[2016.01.08-09.32.04:546]  0]LogTemp:Display: Loaded TP LinuxServerTargetPlatform
[2016.01.08-09.32.04:552]  0]LogTemp:Display: Loaded TP LinuxTargetPlatform
[2016.01.08-09.32.04:552]  0]LogTargetPlatformManager:Display: Building Assets For Windows
[2016.01.08-09.32.04:708]  0]LogDerivedDataCache:Display: Max Cache Size: 512 MB
[2016.01.08-09.32.04:749]  0]LogDerivedDataCache: Loaded boot cache 0.04s 41MB C:/Users/Human/AppData/Local/UnrealEngine/4.10/DerivedDataCache/Boot.ddc.
[2016.01.08-09.32.04:749]  0]LogDerivedDataCache:Display: Loaded Boot cache: C:/Users/Human/AppData/Local/UnrealEngine/4.10/DerivedDataCache/Boot.ddc
[2016.01.08-09.32.04:749]  0]LogDerivedDataCache: FDerivedDataBackendGraph:  Pak pak cache file E:/Projects/UE4/Sjors/DerivedDataCache/DDC.ddp not found, will not use a pak cache.
[2016.01.08-09.32.04:749]  0]LogDerivedDataCache: Unable to find inner node Pak for hierarchical cache Hierarchy.
[2016.01.08-09.32.04:749]  0]LogDerivedDataCache: FDerivedDataBackendGraph:  CompressedPak pak cache file E:/Projects/UE4/Sjors/DerivedDataCache/Compressed.ddp not found, will not use a pak cache.
[2016.01.08-09.32.04:750]  0]LogDerivedDataCache: Unable to find inner node CompressedPak for hierarchical cache Hierarchy.
[2016.01.08-09.32.04:796]  0]LogDerivedDataCache:Display: Pak cache opened for reading ../../../Engine/DerivedDataCache/Compressed.ddp.
[2016.01.08-09.32.04:808]  0]LogDerivedDataCache: Using Local data cache path C:/Users/Human/AppData/Local/UnrealEngine/Common/DerivedDataCache: Writable
[2016.01.08-09.32.04:964]  0]LogInit: Selected Device Profile: [Windows]
[2016.01.08-09.32.04:967]  0]LogContentStreaming: Texture pool size is 0.000000MB
[2016.01.08-09.32.05:066]  0]LogMeshUtilities: No automatic mesh reduction module available
[2016.01.08-09.32.05:066]  0]LogMeshUtilities: No automatic mesh merging module available
[2016.01.08-09.32.05:256]  0]LogInit: WinSock: version 1.1 (2.2), MaxSocks=32767, MaxUdp=65467
[2016.01.08-09.32.06:051]  0]UdpMessaging: Initializing bridge on interface 0.0.0.0:0 to multicast group 230.0.0.1:6666.
[2016.01.08-09.32.06:210]  0]LogAssetRegistry: FAssetRegistry took 0.0119 seconds to start up
[2016.01.08-09.32.06:443]  0]SourceControl: Info Source control is disabled
[2016.01.08-09.32.06:482]  0]SourceControl: Info Source control is disabled
[2016.01.08-09.32.06:498]  0]SourceControl: Info Source control is disabled
[2016.01.08-09.32.06:515]  0]SourceControl: Info Source control is disabled
[2016.01.08-09.32.06:812]  0]LogObj: 29019 objects as part of root set at end of initial load.
[2016.01.08-09.32.06:812]  0]LogUObjectAllocator: 6186800 out of 0 bytes used by permanent object pool.
[2016.01.08-09.32.06:878]  0]LogEngine: Initializing Engine...
[2016.01.08-09.32.06:880]  0]LogHMD: Can't find Oculus library dev build: is proper Runtime installed? Version: 0.8.0.0
[2016.01.08-09.32.06:882]  0]LogHMD: SteamVR failed to initialize.  Err: 110
[2016.01.08-09.32.06:981]  0]LogAIModule: Creating AISystem for world NewWorld
[2016.01.08-09.32.06:988]  0]LogInit: XAudio2 using 'Speakers (Plantronics GameCom 780)' : 6 channels at 44.1 kHz using 16 bits per sample (channel mask 0x60f)
[2016.01.08-09.32.07:000]  0]LogInit: FAudioDevice initialized.
[2016.01.08-09.32.07:018]  0]LogDerivedDataCache: Saved boot cache 0.02s 41MB C:/Users/Human/AppData/Local/UnrealEngine/4.10/DerivedDataCache/Boot.ddc.
[2016.01.08-09.32.07:024]  0]LogInit: Texture streaming: Enabled
[2016.01.08-09.32.07:039]  0]LogAnalytics: Creating configured Analytics provider AnalyticsET
[2016.01.08-09.32.07:039]  0]LogAnalytics: [UEEditor.Rocket.Release] APIServer = http://et2.epicgames.com/ET2/. AppVersion = 4.10.1-2791327+++depot+UE4-Releases+4.10
[2016.01.08-09.32.07:039]  0]LogAnalytics: [UEEditor.Rocket.Release] SetUserId fceb9541491b9511759844a18b2da538|2c2f8e1fa17143548bbea92a7f226f99|f88a08af-1696-4862-abe1-1f37506b0d51
[2016.01.08-09.32.07:039]  0]LogAnalytics: [UEEditor.Rocket.Release] AnalyticsET::StartSession
[2016.01.08-09.32.07:054]  0]LogInit: Transaction tracking system initialized
[2016.01.08-09.32.07:117]  0]BlueprintLog: New page: Editor Load
[2016.01.08-09.32.07:351]  0]LocalizationService: Info Localization service is disabled
[2016.01.08-09.32.07:589]  0]LogConsoleResponse:Display: 
[2016.01.08-09.32.07:685]  0]LogCook:Display: Done creating registry. It took  0.00s.
[2016.01.08-09.32.07:811]  0]LogFileCache: Scanning file cache for directory 'E:/Projects/UE4/Sjors/Content/' took 0.01s
[2016.01.08-09.32.07:811]  0]SourceControl: Info Source control is disabled
[2016.01.08-09.32.07:811]  0]Cmd: MAP LOAD FILE="E:/Projects/UE4/Sjors/Content/Maps/Menus/MainMenu.umap" TEMPLATE=0 SHOWPROGRESS=1 FEATURELEVEL=3
[2016.01.08-09.32.07:811]  0]LightingResults: New page: Lighting Build
[2016.01.08-09.32.07:814]  0]MapCheck: New page: Map Check
[2016.01.08-09.32.07:814]  0]LightingResults: New page: Lighting Build
[2016.01.08-09.32.07:822]  0]LogParticles: Destroying 0 GPU particle simulations for FXSystem 0x0000019CACA9D1C0
[2016.01.08-09.32.08:301]  0]LogAIModule: Creating AISystem for world MainMenu
[2016.01.08-09.32.08:305]  0]LogSkeletalMesh: UPhysicsAssetInstance::InitInstance : Could not find root physics body: SkeletalMeshComponent0
[2016.01.08-09.32.08:307]  0]LogEditorServer: Finished looking for orphan Actors (0.000 secs)
[2016.01.08-09.32.08:307]  0]Cmd: MAP CHECKDEP NOCLEARLOG
[2016.01.08-09.32.08:348]  0]MapCheck: Info Map check complete: 0 Error(s), 0 Warning(s), took 40.693ms to complete.
[2016.01.08-09.32.08:349]  0]LogFileHelpers: Loading map 'MainMenu' took 0.538
[2016.01.08-09.32.08:448]  0]LogCollectionManager: Loaded 0 collections in 0.002163 seconds
[2016.01.08-09.32.08:490]  0]LogFileCache: Scanning file cache for directory 'E:/Projects/UE4/Sjors/Saved/Collections/' took 0.01s
[2016.01.08-09.32.08:490]  0]LogFileCache: Scanning file cache for directory 'E:/Projects/UE4/Sjors/Content/Developers/Human/Collections/' took 0.01s
[2016.01.08-09.32.08:490]  0]LogFileCache: Scanning file cache for directory 'E:/Projects/UE4/Sjors/Content/Collections/' took 0.01s
[2016.01.08-09.32.08:491]  0]LogCollectionManager: Rebuilt the GUID cache for 0 collections in 0.000001 seconds
[2016.01.08-09.32.08:501]  0]LogContentBrowser: Native class hierarchy populated in 0.0105 seconds. Added 1917 classes and 345 folders.
[2016.01.08-09.32.08:509]  0]LogContentBrowser: Native class hierarchy updated for 'WidgetCarousel' in 0.0022 seconds. Added 0 classes and 0 folders.
[2016.01.08-09.32.08:555]  0]LogContentBrowser: Native class hierarchy updated for 'AddContentDialog' in 0.0023 seconds. Added 0 classes and 0 folders.
[2016.01.08-09.32.08:571]  0]LogContentBrowser: Native class hierarchy updated for 'SceneOutliner' in 0.0024 seconds. Added 1 classes and 2 folders.
[2016.01.08-09.32.08:592]  0]LogCrashTracker: Crashtracker disabled due to settings.
[2016.01.08-09.32.08:595]  0]LogUObjectGlobals:Warning: Failed to find object 'Class None.'
[2016.01.08-09.32.08:619]  0]LogLoad: Full Startup: 6.68 seconds (BP compile: 0.12 seconds)
[2016.01.08-09.32.08:628]  0]LogWindowsTextInputMethodSystem:Display: IME system now deactivated.
[2016.01.08-09.32.08:630]  0]LogOcInput: Can't find Oculus library dev build: is proper Runtime installed? Version: 0.8.0.0
[2016.01.08-09.32.08:681]  0]LogContentStreaming: Texture pool size now 200 MB
[2016.01.08-09.32.08:818]  0]LogRenderer: Reallocating scene render targets to support 1208x572 (Frame:2).
[2016.01.08-09.32.08:955]  4]LogAssetRegistry: Asset discovery search completed in 2.7570 seconds
[2016.01.08-09.32.08:955]  4]LogCollectionManager: Rebuilt the object cache for 0 collections in 0.000001 seconds (found 0 objects)
[2016.01.08-09.32.08:955]  4]LogCollectionManager: Fixed up redirectors for 0 collections in 0.000078 seconds (updated 0 objects)
[2016.01.08-09.32.20:180] 33]LogBlueprintUserMessages: Early PlayInEditor Detection: Level '/Game/Maps/Menus/MainMenu.MainMenu:PersistentLevel' has LevelScriptBlueprint '/Game/Maps/Menus/MainMenu.MainMenu:PersistentLevel.MainMenu' with GeneratedClass '/Game/Maps/Menus/MainMenu.MainMenu_C' with ClassGeneratedBy '/Game/Maps/Menus/MainMenu.MainMenu:PersistentLevel.MainMenu'
[2016.01.08-09.32.20:180] 33]LogPlayLevel: PlayLevel: No blueprints needed recompiling
[2016.01.08-09.32.20:180] 33]PIE: New page: PIE session: MainMenu (Jan 8, 2016, 11:32:20 AM)
[2016.01.08-09.32.20:181] 33]LogPlayLevel: Creating play world package: /Game/Maps/Menus/UEDPIE_0_MainMenu
[2016.01.08-09.32.20:186] 33]LogPlayLevel: PIE: StaticDuplicateObject took: (0.005175s)
[2016.01.08-09.32.20:186] 33]LogAIModule: Creating AISystem for world MainMenu
[2016.01.08-09.32.20:187] 33]LogPlayLevel: PIE: World Init took: (0.000803s)
[2016.01.08-09.32.20:187] 33]LogPlayLevel: PIE: Created PIE world by copying editor world from /Game/Maps/Menus/MainMenu.MainMenu to /Game/Maps/Menus/UEDPIE_0_MainMenu.MainMenu (0.006348s)
[2016.01.08-09.32.20:212] 33]LogInit: XAudio2 using 'Speakers (Plantronics GameCom 780)' : 6 channels at 44.1 kHz using 16 bits per sample (channel mask 0x60f)
[2016.01.08-09.32.20:218] 33]LogInit: FAudioDevice initialized.
[2016.01.08-09.32.20:268] 33]LogWorld: Game class is 'MenuGameMode_C'
[2016.01.08-09.32.20:270] 33]LogSkeletalMesh: UPhysicsAssetInstance::InitInstance : Could not find root physics body: SkeletalMeshComponent0
[2016.01.08-09.32.20:271] 33]LogWorld: Bringing World /Game/Maps/Menus/UEDPIE_0_MainMenu.MainMenu up for play (max tick rate 0) at 2016.01.08-10.32.20
[2016.01.08-09.32.20:271] 33]LogActor:Warning: GameSession /Game/Maps/Menus/UEDPIE_0_MainMenu.MainMenu:PersistentLevel.GameSession_0 has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
[2016.01.08-09.32.20:271] 33]LogActor:Warning: GameNetworkManager /Game/Maps/Menus/UEDPIE_0_MainMenu.MainMenu:PersistentLevel.GameNetworkManager_0 has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
[2016.01.08-09.32.20:272] 33]LogWorld: Bringing up level for play took: 0.002264
[2016.01.08-09.32.20:292] 33]PIE: Info Play in editor start time for /Game/Maps/Menus/UEDPIE_0_MainMenu 0.141
[2016.01.08-09.32.20:293] 33]LogBlueprintUserMessages: Late PlayInEditor Detection: Level '/Game/Maps/Menus/MainMenu.MainMenu:PersistentLevel' has LevelScriptBlueprint '/Game/Maps/Menus/MainMenu.MainMenu:PersistentLevel.MainMenu' with GeneratedClass '/Game/Maps/Menus/MainMenu.MainMenu_C' with ClassGeneratedBy '/Game/Maps/Menus/MainMenu.MainMenu:PersistentLevel.MainMenu'
[2016.01.08-09.32.20:728] 82]LogJson:Warning: Field  was not found.
[2016.01.08-09.32.20:728] 82]LogJson:Error: Json Value of type 'Null' used as a 'String'.
[2016.01.08-09.32.20:729] 82]LogJson:Warning: Field  was not found.
[2016.01.08-09.32.20:729] 82]LogJson:Error: Json Value of type 'Null' used as a 'String'.
[2016.01.08-09.32.21:395][162]LogJson:Warning: Field startWordSet was not found.
[2016.01.08-09.32.21:395][162]LogJson:Error: Json Value of type 'Null' used as a 'Number'.
[2016.01.08-09.32.21:395][162]LogJson:Warning: Field endWordSet was not found.
[2016.01.08-09.32.21:395][162]LogJson:Error: Json Value of type 'Null' used as a 'Number'.
[2016.01.08-09.32.21:455][162]LogPackageName: SearchForPackageOnDisk took   0.060s to resolve dev_rei_gameplayTest_01.umap.
[2016.01.08-09.32.21:509][162]LogPackageName: SearchForPackageOnDisk took   0.053s to resolve dev_rei_gameplayTest_01.umap.
[2016.01.08-09.32.21:509][162]LogNet: Browse: /Game/Dev/ReiMari/Maps/dev_rei_gameplayTest_01??game=Base
[2016.01.08-09.32.21:509][162]LogLoad: LoadMap: /Game/Dev/ReiMari/Maps/dev_rei_gameplayTest_01??game=Base
[2016.01.08-09.32.21:520][162]LogParticles: Destroying 0 GPU particle simulations for FXSystem 0x0000019CBD415B20
[2016.01.08-09.32.21:522][162]Cmd: MEM
[2016.01.08-09.32.21:531][162]LogMemory: Platform Memory Stats for Windows
[2016.01.08-09.32.21:531][162]LogMemory: Process Physical Memory: 609.99 MB used, 622.82 MB peak
[2016.01.08-09.32.21:531][162]LogMemory: Process Virtual Memory: 888.20 MB used, 888.20 MB peak
[2016.01.08-09.32.21:531][162]LogMemory: Physical Memory: 7808.80 MB used, 16360.76 MB total
[2016.01.08-09.32.21:531][162]LogMemory: Virtual Memory: 1616.05 MB used, 134217728.00 MB total
[2016.01.08-09.32.21:531][162]LogMemory: 
[2016.01.08-09.32.21:531][162]Allocator Stats for TBB: (not implemented)
[2016.01.08-09.32.21:800][162]LogAIModule: Creating AISystem for world dev_rei_gameplayTest_01
[2016.01.08-09.32.21:800][162]LogWorld: Game class is 'SjorsGameMode_BP_C'
[2016.01.08-09.32.21:804][162]LogWorld: Bringing World /Game/Dev/ReiMari/Maps/UEDPIE_0_dev_rei_gameplayTest_01.dev_rei_gameplayTest_01 up for play (max tick rate 0) at 2016.01.08-10.32.21
[2016.01.08-09.32.21:804][162]LogActor:Warning: GameSession /Game/Dev/ReiMari/Maps/UEDPIE_0_dev_rei_gameplayTest_01.dev_rei_gameplayTest_01:PersistentLevel.GameSession_1 has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
[2016.01.08-09.32.21:804][162]LogActor:Warning: GameNetworkManager /Game/Dev/ReiMari/Maps/UEDPIE_0_dev_rei_gameplayTest_01.dev_rei_gameplayTest_01:PersistentLevel.GameNetworkManager_1 has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
[2016.01.08-09.32.21:804][162]LogWorld: Bringing up level for play took: 0.002989
[2016.01.08-09.32.21:805][162]LogActor:Warning: Sjors_BP_C /Game/Dev/ReiMari/Maps/UEDPIE_0_dev_rei_gameplayTest_01.dev_rei_gameplayTest_01:PersistentLevel.Sjors_BP_C_0 has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
[2016.01.08-09.33.13:321][328]LogBlueprintUserMessages: [UI_Game_C_0] Remaining: 5
[2016.01.08-09.33.25:476][785]LogBlueprintUserMessages: [UI_Game_C_0] Remaining: 4
2016.01.

Are you sure your widget is not null? The only way to be sure is to put a if (Widget!=NULL) before calling any function on it try doing that and see what happens

Another suspicious thing I notice is

Is that normal behavior?

When I hover over the widget variable in Visual Studio during the breakpoint it doesn’t appear null.
SetWidgetEnabled() starts with:
if (!Widget) return;
And it doesn’t always get caused by accessing the widget (for example in the case where it crashes in ScriptCore).

Those null Json values shouldn’t cause any problems as all of the questions are loaded before the level starts. I’d expect it to crash at that point if anything went wrong there.
I’ve also checked the internal values of all of the questions, and they always have all of their data set even when those json errors occur.
After doing some more digging where those json errors are coming from I’ve found they’re coming from the main menu which shouldn’t cause the weird behaviour.

Still I think there can be something after that if (!Widget) return; and before ** IsInViewport()** that might get Widget garbage collected or de-referenced as I can see

And a Weak-pointer can get garbage collected anytime in the middle of execution. Even so I can’t say its exactly that is the problem. try putting a if exactly before the Is in Viewport

The best info you could get would be if you could get a crash report stack.

UUserWidget.cpp is inside Unreal Engine itself, all that IsInViewport function does is:
return FullScreenWidget.IsValid();
So putting a null check right before that seems a bit pointless.

Nope that’s not the point, You’re calling IsInViewport() on a pointer named Widget if this pointer is null then Widget->IsInViewPort() will give you an access violation and a crash. :smiley:

The check return FullScreenWidget.IsValid(); would only happen if Widget was a valid pointer to an object

The entire SetWidgetEnabled function now looks like this:

void ASjorsGameMode::SetWidgetEnabled(bool Enabled, UUserWidget* Widget)
{
if (!Widget || Widget == NULL) return;

if (Enabled)
{
	if (Widget != NULL && !Widget-&gt;IsInViewport())
		Widget-&gt;AddToViewport();
}
else
{
	if (Widget != NULL && Widget-&gt;IsInViewport())
		Widget-&gt;RemoveFromViewport();
}

}

It’s still crashing on
if (Widget != NULL && !Widget->IsInViewport())
(inside of IsInViewport())

Ok I’m making a wild guess here , so bear with me, based on some web searches it seems the not operator or exclamation symbol (!) can do a not operation on a pointer just like it does on an integer.

Hence the line !Widget->IsInViewport() looks like the culprit change it to !(Widget->IsInViewport()) or Widget->IsInViewport()==false and see what happens

apprantly if your widget pointer has a value of 1000001 in memory you might be calling IsInViewport on 0111110 due to the ! operator before it which obviously lead to crash as 0111110 will be an illegal pointer

Unfortunately changing the check to Widget->IsInViewport() == false hasn’t fixed it.
When I hover over the pointers in Visual Studio during the exception it’s clear that widget isn’t null, and everything it contains also seems to be the way it should.
The contents of FullScreenWidget (in UserWidget.cpp) does however seem to be null.
I found that AddToViewport and RemoveFromViewport were already doing checks internally to make sure you can’t add the same widget twice, so I decided to remove all of
the problematic IsInViewport checks. It did end up making a slight difference, but only where exactly an exception gets thrown. Which is now at line 450 in UserWidget.cpp:
if ( !FullScreenWidget.IsValid() )
Again, FullScreenWidget is null at that point.
Finally I’ve also taken a look at what IsValid really does, and it does actually check for null before anything else.

Update on the whole situation:
All crashes fixed, just had to put UPROPERTY() in front of pretty much every pointer to UObject (or anything that inherits it, including UUserWidget) which prevents the garbage collector from messing with the pointers.
Credit goes to ‘cancel’ on Slack.

good point.