void UInAppPurchaseCallbackProxy::BeginDestroy()
{
    PurchaseRequest = nullptr;
    RemoveDelegate();

    Super::BeginDestroy();
}
void UAbilityTask_WaitGameplayEffectApplied::OnDestroy(bool AbilityEnded)
{
	if (GetASC())
	{
		RemoveDelegate();
	}

	Super::OnDestroy(AbilityEnded);
}
void ULeaderboardFlushCallbackProxy::OnFlushCompleted(FName SessionName, bool bWasSuccessful)
{
	RemoveDelegate();

	if (bWasSuccessful)
	{
		OnSuccess.Broadcast(SessionName);
	}
	else
	{
		OnFailure.Broadcast(SessionName);
	}
}
void UInAppPurchaseCallbackProxy::OnInAppPurchaseComplete(EInAppPurchaseState::Type CompletionState, const IPlatformPurchaseReceipt* ProductReceipt)
{
	RemoveDelegate();
	SavedPurchaseState = CompletionState;
    SavedPurchaseReceipt = ProductReceipt;
    
	if (UWorld* World = WorldPtr.Get())
	{
		World->GetTimerManager().SetTimer(this, &UInAppPurchaseCallbackProxy::OnInAppPurchaseComplete_Delayed, 0.001f, false);
    }
    else
    {
        PurchaseRequest = nullptr;
    }
}
void UInAppPurchaseCallbackProxy::OnInAppPurchaseComplete(EInAppPurchaseState::Type CompletionState)
{
    RemoveDelegate();
    SavedPurchaseState = CompletionState;

    if (UWorld* World = WorldPtr.Get())
    {
        // Use a local timer handle as we don't need to store it for later but we don't need to look for something to clear
        FTimerHandle TimerHandle;
        World->GetTimerManager().SetTimer(OnInAppPurchaseComplete_DelayedTimerHandle, this, &UInAppPurchaseCallbackProxy::OnInAppPurchaseComplete_Delayed, 0.001f, false);
    }
    else
    {
        PurchaseRequest = nullptr;
    }
}
void ULeaderboardFlushCallbackProxy::BeginDestroy()
{
	RemoveDelegate();

	Super::BeginDestroy();
}