landelare / ue5coro

A C++20 coroutine implementation for Unreal Engine 5 that feels almost native.
BSD 3-Clause Clear License
543 stars 48 forks source link

SIGSEGV: invalid attempt to access memory at address 0x0 #21

Closed OneXeor closed 7 months ago

OneXeor commented 7 months ago

Hello, I'm new to cpp and I have encountered the following issue and do not know what I can do to move forward. It occurs right after the invocation of the Latent function. Tell me please what is wrong with it or with my code, and how can I fix it?

Caught signal

Unknown() Address = 0x0 (filename not found) [in ???]
UE5Coro::Private::FPromise::Resume(bool) Address = 0x28b8f0598 [/some_path/Plugins/UE5Coro/Source/UE5Coro/Private/Promise.cpp, line 143] [in UnrealEditor-UE5Coro.dylib]
(anonymous namespace)::FPendingLatentCoroutine::UpdateOperation(FLatentResponse&) Address = 0x28b8e7338 [/some_path/Plugins/UE5Coro/Source/UE5Coro/Private/LatentPromise.cpp, line 94] [in UnrealEditor-UE5Coro.dylib]
FLatentActionManager::TickLatentActionForObject(float, TMultiMap<int, FPendingLatentAction*, FDefaultSetAllocator, TDefaultMapHashableKeyFuncs<int, FPendingLatentAction*, true>>&, UObject*) Address = 0x118712178 (filename not found) [in UnrealEditor-Engine.dylib]
FLatentActionManager::ProcessLatentActions(UObject*, float) Address = 0x118710f78 (filename not found) [in UnrealEditor-Engine.dylib]
UWorld::Tick(ELevelTick, float) Address = 0x1187cfbc4 (filename not found) [in UnrealEditor-Engine.dylib]
UEditorEngine::Tick(float, bool) Address = 0x1125b077c (filename not found) [in UnrealEditor-UnrealEd.dylib]
UUnrealEdEngine::Tick(float, bool) Address = 0x1133076b8 (filename not found) [in UnrealEditor-UnrealEd.dylib]
FEngineLoop::Tick() Address = 0x102908844 (filename not found) [in UnrealEditor]
GuardedMain(char16_t const*) Address = 0x102914b10 (filename not found) [in UnrealEditor]
-[UEAppDelegate runGameThread:] Address = 0x10292fcd0 (filename not found) [in UnrealEditor]
-[FCocoaGameThread main] Address = 0x1067753d8 (filename not found) [in UnrealEditor-Core.dylib]
Unknown() Address = 0x18d8a7d14 (filename not found) [in Foundation]
Unknown() Address = 0x18c6cb034 (filename not found) [in libsystem_pthread.dylib]
Unknown() Address = 0x18c6c5e3c (filename not found) [in libsystem_pthread.dylib]
#include "OKAuthComponent.h"
#include "UAuthorisationUseCase.h"
#include "UE5Coro.h"

UFUNCTION(BlueprintCallable, Meta = (Latent, LatentInfo = "LatentInfo"))
FAsyncCoroutine UOKAuthComponent::HandleOKSuccessLink(
    FLatentActionInfo LatentInfo,
    const FString Link,
    FAuthorisationResponse& Response
)
{
    UE_LOG(LogTemp, Display, TEXT("Link data %s"), *Link);

    TArray<FString> Out;
    Link.ParseIntoArray(Out, TEXT("&"), true);

    FString ServerCode = "";
    FString SessionSecretKey = "";

    for (FString String : Out)
    {
        if (String.Contains("code="))
        {
            String.Split("=", nullptr, &ServerCode);
        }
    }

    FAuthorisationRequest RequestBody = FAuthorisationRequest();
    RequestBody.Code = ServerCode;
    RequestBody.ProviderName = TEXT("ok");
    co_await UAuthorisationUseCase::RunAction(RequestBody, Response);
    co_return;
}
landelare commented 7 months ago

Some crucial info is missing from that call stack, could you please run at least DebugGame Editor (full "gameless" Debug/Debug Editor preferable if you have one) and look at what exactly is causing the segfault?

In particular, what's the version of UE5Coro and Unreal used and the value of this for the FPromise object before it calls resume() on line 143?

UAuthorisationUseCase is not part of the engine so it's not something I can look into.

landelare commented 7 months ago

Closing this due to no actionable bug report. If you tracked this one down to a bug in UE5Coro, please feel free to reopen with more information.