Unreal crashed because of a function running.

I got this:
LoginId:
EpicAccountId:

Caught signal

UTagSystem::add(UTagSystem*) Address = 0x155e7f808 [/Users//Documents/Unreal Projects/CLLS/Source/CLLS/TagSys.cpp, line 13] [in UE4Editor-CLLS-6568.dylib]
Uinventorylogic::insertItem(UItem*) Address = 0x155e81c39 [/Users//Documents/Unreal Projects/CLLS/Source/CLLS/inventorylogic.cpp, line 38] [in UE4Editor-CLLS-6568.dylib]
Uinventorylogic::execinsertItem(UObject*, FFrame&, void*) Address = 0x155e8f82e [/Users//Documents/Unreal Projects/CLLS/Intermediate/Build/Mac/UE4Editor/Inc/CLLS/inventorylogic.gen.cpp, line 63] [in UE4Editor-CLLS-6568.dylib]
UFunction::Invoke(UObject*, FFrame&, void*) Address = 0x10ac31bfc (filename not found) [in UE4Editor-CoreUObject.dylib]
UObject::CallFunction(FFrame&, void*, UFunction*) Address = 0x10ae741e8 (filename not found) [in UE4Editor-CoreUObject.dylib]
UObject::ProcessContextOpcode(FFrame&, void*, bool) Address = 0x10ae83949 (filename not found) [in UE4Editor-CoreUObject.dylib]
UObject::execLet(UObject*, FFrame&, void*) Address = 0x10ae82ebc (filename not found) [in UE4Editor-CoreUObject.dylib]
ProcessLocalScriptFunction(UObject*, FFrame&, void*) Address = 0x10ae75b2f (filename not found) [in UE4Editor-CoreUObject.dylib]
void ProcessScriptFunction<void ()(UObject, FFrame&, void*)>(UObject*, UFunction*, FFrame&, void*, void ()(UObject, FFrame&, void*)) Address = 0x10ae754a4 (filename not found) [in UE4Editor-CoreUObject.dylib]
ProcessLocalFunction(UObject*, UFunction*, FFrame&, void*) Address = 0x10ae76818 (filename not found) [in UE4Editor-CoreUObject.dylib]
ProcessLocalScriptFunction(UObject*, FFrame&, void*) Address = 0x10ae75b2f (filename not found) [in UE4Editor-CoreUObject.dylib]
UFunction::Invoke(UObject*, FFrame&, void*) Address = 0x10ac31bfc (filename not found) [in UE4Editor-CoreUObject.dylib]
UObject::ProcessEvent(UFunction*, void*) Address = 0x10ae7c747 (filename not found) [in UE4Editor-CoreUObject.dylib]
UUserWidget::NativeConstruct() Address = 0x119d6f69e (filename not found) [in UE4Editor-UMG.dylib]
UUserWidget::OnWidgetRebuilt() Address = 0x119d6c52f (filename not found) [in UE4Editor-UMG.dylib]
UWidget::TakeWidget_Private(TFunctionRef<TSharedPtr<SObjectWidget, (ESPMode)0> (UUserWidget*, TSharedRef<SWidget, (ESPMode)0>)>) Address = 0x119d3bd81 (filename not found) [in UE4Editor-UMG.dylib]
UUserWidget::AddToScreen(ULocalPlayer*, int) Address = 0x119d6d760 (filename not found) [in UE4Editor-UMG.dylib]
UUserWidget::execAddToViewport(UObject*, FFrame&, void*) Address = 0x119eb436a (filename not found) [in UE4Editor-UMG.dylib]
UFunction::Invoke(UObject*, FFrame&, void*) Address = 0x10ac31bfc (filename not found) [in UE4Editor-CoreUObject.dylib]
UObject::CallFunction(FFrame&, void*, UFunction*) Address = 0x10ae741e8 (filename not found) [in UE4Editor-CoreUObject.dylib]
UObject::ProcessContextOpcode(FFrame&, void*, bool) Address = 0x10ae83949 (filename not found) [in UE4Editor-CoreUObject.dylib]
ProcessLocalScriptFunction(UObject*, FFrame&, void*) Address = 0x10ae75b2f (filename not found) [in UE4Editor-CoreUObject.dylib]
void ProcessScriptFunction<void ()(UObject, FFrame&, void*)>(UObject*, UFunction*, FFrame&, void*, void ()(UObject, FFrame&, void*)) Address = 0x10ae754a4 (filename not found) [in UE4Editor-CoreUObject.dylib]
ProcessLocalFunction(UObject*, UFunction*, FFrame&, void*) Address = 0x10ae76818 (filename not found) [in UE4Editor-CoreUObject.dylib]
ProcessLocalScriptFunction(UObject*, FFrame&, void*) Address = 0x10ae75b2f (filename not found) [in UE4Editor-CoreUObject.dylib]
UFunction::Invoke(UObject*, FFrame&, void*) Address = 0x10ac31bfc (filename not found) [in UE4Editor-CoreUObject.dylib]
UObject::ProcessEvent(UFunction*, void*) Address = 0x10ae7c747 (filename not found) [in UE4Editor-CoreUObject.dylib]
AActor::ProcessEvent(UFunction*, void*) Address = 0x10b69ff79 (filename not found) [in UE4Editor-Engine.dylib]
void TScriptDelegate<FWeakObjectPtr>::ProcessDelegate<UObject>(void*) const Address = 0x10b6f93c3 (filename not found) [in UE4Editor-Engine.dylib]
FInputActionHandlerDynamicSignature::Execute(FKey) const Address = 0x10cbfd37b (filename not found) [in UE4Editor-Engine.dylib]
FInputActionUnifiedDelegate::Execute(FKey) const Address = 0x10cbe6709 (filename not found) [in UE4Editor-Engine.dylib]
UPlayerInput::ProcessInputStack(TArray<UInputComponent*, TSizedDefaultAllocator<32> > const&, float, bool) Address = 0x10cbe42a6 (filename not found) [in UE4Editor-Engine.dylib]
APlayerController::ProcessPlayerInput(float, bool) Address = 0x10c5f046f (filename not found) [in UE4Editor-Engine.dylib]
APlayerController::TickPlayerInput(float, bool) Address = 0x10c5ee912 (filename not found) [in UE4Editor-Engine.dylib]
APlayerController::PlayerTick(float) Address = 0x10c5ee249 (filename not found) [in UE4Editor-Engine.dylib]
APlayerController::TickActor(float, ELevelTick, FActorTickFunction&) Address = 0x10c5f8ef4 (filename not found) [in UE4Editor-Engine.dylib]
FActorTickFunction::ExecuteTick(float, ELevelTick, ENamedThreads::Type, TRefCountPtr<FGraphEvent> const&) Address = 0x10b69ab8d (filename not found) [in UE4Editor-Engine.dylib]
FTickFunctionTask::DoTask(ENamedThreads::Type, TRefCountPtr<FGraphEvent> const&) Address = 0x10cab2386 (filename not found) [in UE4Editor-Engine.dylib]
TGraphTask<FTickFunctionTask>::ExecuteTask(TArray<FBaseGraphTask*, TSizedDefaultAllocator<32> >&, ENamedThreads::Type) Address = 0x10cab1c67 (filename not found) [in UE4Editor-Engine.dylib]
FNamedTaskThread::ProcessTasksNamedThread(int, bool) Address = 0x10934eac6 (filename not found) [in UE4Editor-Core.dylib]
FNamedTaskThread::ProcessTasksUntilQuit(int) Address = 0x10934d8f3 (filename not found) [in UE4Editor-Core.dylib]
FTaskGraphImplementation::WaitUntilTasksComplete(TArray<TRefCountPtr<FGraphEvent>, TInlineAllocator<4u, TSizedDefaultAllocator<32> > > const&, ENamedThreads::Type) Address = 0x10934ada0 (filename not found) [in UE4Editor-Core.dylib]
FTickTaskSequencer::ReleaseTickGroup(ETickingGroup, bool) Address = 0x10caaadda (filename not found) [in UE4Editor-Engine.dylib]
FTickTaskManager::RunTickGroup(ETickingGroup, bool) Address = 0x10caa4fc6 (filename not found) [in UE4Editor-Engine.dylib]
UWorld::Tick(ELevelTick, float) Address = 0x10c0814fe (filename not found) [in UE4Editor-Engine.dylib]
UEditorEngine::Tick(float, bool) Address = 0x113ec61b1 (filename not found) [in UE4Editor-UnrealEd.dylib]
UUnrealEdEngine::Tick(float, bool) Address = 0x114a27f18 (filename not found) [in UE4Editor-UnrealEd.dylib]
FEngineLoop::Tick() Address = 0x108fda8f7 (filename not found) [in UE4Editor]
GuardedMain(char16_t const*) Address = 0x108fe57af (filename not found) [in UE4Editor]
-[UE4AppDelegate runGameThread:] Address = 0x10900207f (filename not found) [in UE4Editor]
-[FCocoaGameThread main] Address = 0x109548931 (filename not found) [in UE4Editor-Core.dylib]
Unknown() Address = 0x7fff36d3b7a2 (filename not found) [in Foundation]
_pthread_start Address = 0x7fff6e8ac109 (filename not found) [in libsystem_pthread.dylib]
thread_start Address = 0x7fff6e8a7b8b (filename not found) [in libsystem_pthread.dylib]

The function in question, the add function’s code, is:
UTagSystem* UTagSystem::add(UTagSystem* singularTag)

{

UTagSystem* added = NewObject<UTagSystem>(singularTag->GetOuter());

added = this;

for (auto& Elem : singularTag->tagCollector)

{

if (added->tagCollector.Contains(Elem.Key))

{

added->tagCollector[Elem.Key] += Elem.Value;

}

else

{

added->tagCollector.Add(Elem.Key, Elem.Value);

}

}

return added;

}
Thank you!

UTagSystem* added = NewObject<UTagSystem>(singularTag->GetOuter());

added = this;

Why do you assign added twice? Are you sure you want to do added = this; ?

Okay, that worked. Now, I have a similar error.
void UTagSystem::set(TMap<FString,int> tagStorage)

{

tagCollector.Empty(tagStorage.Num());

tagCollector.Append(tagStorage);

}
This function crashes it as well. I don’t know why.

Probably because “UTagSystem” isn’t valid. How are you creating the UTagSystem object? Also you probably want to pass by reference rather than value there (otherwise you’re making a copy of that “tagStorage” object).



**void** UTagSystem::set(const TMap<FString,**int**>& tagStorage)
{
   tagCollector.Empty(tagStorage.Num());
   tagCollector.Append(tagStorage);
}


I’m passing from a struct. The UTagSystem is a member variable of a class.

And you are creating that UTagSystem using NewObject?



USTRUCT()
struct MyStruct
{
  UPROPERTY()
  UTagSystem MyTags; // This is invalid. You cannot allocate UObjects like this.
}




USTRUCT()
struct MyStruct
{
  // Default struct constructor.
  MyStruct()  : MyTags(nullptr)
  {
    // Allocate the MyTags object and assigns it to our pointer.
    MyTags = NewObject<UTagSystem>();
  }

UPROPERTY() // Mark as a UPROPERTY so the GC system sees we're using this object once we allocate it.
UTagSystem* MyTags; // This is a pointer to a UTagSystem.
}


Thank you, it worked!

How do I create a constructor for a UUserWidget? Is it possible?