Crash in UClass::AssembleReferenceTokenStream

Been having constant crash, here’s the call stack

UE4Editor-CoreUObject.dll!TFieldIterator::IterateToNext() Line 2896 C++
UE4Editor-CoreUObject.dll!UClass::AssembleReferenceTokenStream() Line 1584 C++
UE4Editor-CoreUObject.dll!FArchiveRealtimeGC::PerformReachabilityAnalysis(EObjectFlags KeepFlags, bool bForceSingleThreaded) Line 469 C++
UE4Editor-CoreUObject.dll!CollectGarbage(EObjectFlags KeepFlags, bool bPerformFullPurge) Line 1137 C++
UE4Editor-UnrealEd.dll!UEditorEngine::EndPlayMap() Line 195 C++
UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1465 C++
UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 278 C++
UE4Editor.exe!FEngineLoop::Tick() Line 2129 C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 133 C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 190 C++

Basically, I have a blueprint class derived from UItem which is derived from UObject. I create this blueprint class in the constructor of an actor like so

Item = ConstructObject<UItem>(ItemClass->GetClass());

When I press play, everything seems ok, but always crash when stopping.

This is how I declare the property inside the actor

UPROPERTY(Category = "Item", VisibleInstanceOnly, BlueprintReadOnly)
UItem* Item;

Any pointer on what I’m doing wrong here ?

I was getting the class of a class, no wonder it crashed. Changing the construction like the following works

Item = ConstructObject<UItem>(ItemClass);