FTickableGameObject casuse crash on closing.

Hi everyone,

I’m making an HUD components library but i’m running in a problem with components using the “FTickableGameObject” class along with the PlayerController. The game breaks (with a 30% chance) when hitting the “STOP” button in the editor.
The break is generated in the Tick event and reports:



     First-chance exception at 0x000007FEE725E2E8 (UE4Editor-CoreUObject.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x0000004300000052.
     Unhandled exception at 0x000007FEE725E2E8 (UE4Editor-CoreUObject.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x0000004300000052.


The code generating the break is the following:


  
    if (!(HUDPlayerController))
         return; //trying to skip the break
    if (HUDPlayerController->IsPendingKillPending()||HUDPlayerController->IsPendingKill())
         return;//trying to skip the break
    float mouseX = 0; float mouseY = 0;
         UHUDCComponent::HUDPlayerController->GetMousePosition(mouseX, mouseY);
    //this line generates the break
    bool currentMouseState = UHUDCComponent::HUDPlayerController->IsInputKeyDown(EKeys::LeftMouseButton);


I can imagine that it’s something related to the PlayerController being disposed before the tick event stops but i tried checking the “IsPendingKill” value for that reason with no luck.
What should be the correct way to use the Player Controller in an FTickableGameObject object? Any ideas on how i can solve this?

Thanks in advance.

Ps:i even tried wrapping it with a try/catch but the exception still stops the execution.

Ok,after 2 days with this error,it seems that the solution to it was to add
“UPROPERTY()” to the declaration of the PlayerController i was using.

I had the same issue with creating Decorators for SRichTextBlock. UPROPERTY() before URichTextBlockDecorator fixed it. Thanks.