Description

The crash occurs when trying to assign a new value to RootComponent if the Pawn is already placed on the level

Crash does not happen in  P4 //UE4/Release-4.25.3 CL 13942748

Other steps to reproduce №1:
1) Create Blank C++ project
2) Create a new Pawn C++ class.
3) Open MyPawn.cpp
4) Add two includes:

#include "UObject/ConstructorHelpers.h"
#include "Components/SphereComponent.h"

5) Add two lines under PrimaryActorTick.bCanEverTick = true;

USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
RootComponent = SphereComponent;

6) Place the Pawn on the level
7) Compile
Result: Editor crashed with the same Callstack

 

Other steps to reproduce №2:

1) Create a Blank C++ project With Starter Content
2) Create a new Actor C++ class. Name it MyClass
3) Open MyClass.h. 
4) Add following lines under AMyClass();

UPROPERTY(VisibleAnywhere)
UStaticMeshComponent* VisualMesh;

5) Open MyClass.cpp
6) Add following lines under PrimaryActorTick.bCanEverTick = true;

VisualMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Test Mesh"));
VisualMesh->SetupAttachment(RootComponent);
static ConstructorHelpers::FObjectFinder<UStaticMesh> 
CubeVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube")); 
if (CubeVisualAsset.Succeeded()) { 
VisualMesh->SetStaticMesh(CubeVisualAsset.Object); VisualMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f)); 
}

7) Compile and place MyClass on the level
8) Change 

VisualMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Test Mesh"));  

to

VisualMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Test1 Mesh"));

9) Compile again

Actual: Crash at the end of compiling 

Steps to Reproduce

1) Create Blank C++ project
2) Create a new Pawn C++ class.
3) Open MyPawn.cpp
4) Add line under PrimaryActorTick.bCanEverTick = true;

RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));

6) Place the Pawn on the level
7) Compile

Actual: Crash at the end of compiling 

Expected: Compiling successfully. Subobject for RootComponent is created.

Callstack
UE4Editor_CoreUObject!GetArchetypeFromRequiredInfoImpl() [UObjectArchetype.cpp:131]
UE4Editor_CoreUObject!GetArchetypeFromRequiredInfoImpl() [UObjectArchetype.cpp:82]
UE4Editor_CoreUObject!UObject::GetArchetype() [UObjectArchetype.cpp:207]
UE4Editor_Engine!AActor::PostSpawnInitialize() [Actor.cpp:3112]
UE4Editor_Engine!UWorld::SpawnActor() [LevelActor.cpp:567]
UE4Editor_Engine!UWorld::SpawnActor() [LevelActor.cpp:304]
UE4Editor_UnrealEd!ReplaceActorHelper() [KismetReinstanceUtilities.cpp:1832]
UE4Editor_UnrealEd!FBlueprintCompileReinstancer::ReplaceInstancesOfClass_Inner() [KismetReinstanceUtilities.cpp:2114]
UE4Editor_UnrealEd!FBlueprintCompileReinstancer::ReplaceInstancesOfClass() [KismetReinstanceUtilities.cpp:1499]
UE4Editor_UnrealEd!FBlueprintCompileReinstancer::ReinstanceInner() [KismetReinstanceUtilities.cpp:707]
UE4Editor_UnrealEd!FBlueprintCompileReinstancer::ReinstanceObjects() [KismetReinstanceUtilities.cpp:781]
UE4Editor_HotReload!FHotReloadModule::ReinstanceClass() [HotReload.cpp:1258]
UE4Editor_HotReload!FHotReloadModule::ReinstanceClasses() [HotReload.cpp:1244]
UE4Editor_HotReload!TBaseRawMethodDelegateInstance<0,FHotReloadModule,void __cdecl(void) [DelegateInstancesImpl.h:469]
UE4Editor_CoreUObject!UClassReplaceHotReloadClasses() [UObjectBase.cpp:842]
UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() [UObjectBase.cpp:1002]
UE4Editor_CoreUObject!TBaseStaticDelegateInstance<void __cdecl(FName,bool) [DelegateInstancesImpl.h:731]
UE4Editor_Core!TMulticastDelegate<void __cdecl(FName,bool) [DelegateSignatureImpl.inl:955]
UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() [ModuleManager.cpp:508]
UE4Editor_Core!FModuleManager::LoadModule() [ModuleManager.cpp:342]
UE4Editor_HotReload!FHotReloadModule::DoHotReloadInternal() [HotReload.cpp:799]
UE4Editor_HotReload!UE4Function_Private::TFunctionRefCaller<<lambda_d85446a946c3f6776c68ebfeb93e5785>,void __cdecl(TMap<FName,FString,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<FName,FString,0> > const &,bool,enum ECompilationResult::Type) [Function.h:549]
UE4Editor_HotReload!FHotReloadModule::CheckForFinishedModuleDLLCompile() [HotReload.cpp:1853]
UE4Editor_HotReload!FHotReloadModule::Tick() [HotReload.cpp:1415]
UE4Editor_Core!FTicker::Tick() [Ticker.cpp:95]
UE4Editor!FEngineLoop::Tick() [LaunchEngineLoop.cpp:5043]
UE4Editor!GuardedMain() [Launch.cpp:169]
UE4Editor!GuardedMainWrapper() [LaunchWindows.cpp:137]
UE4Editor!WinMain() [LaunchWindows.cpp:268]
UE4Editor!__scrt_common_main_seh() [exe_common.inl:288]

Have Comments or More Details?

There's no existing public thread on this issue, so head over to AnswerHub just mention UE-102707 in the post.

3
Login to Vote

Fixed
ComponentDevTools - Hot Reload
Affects Versions4.26
Target Fix4.26.1
Fix Commit15001414
Release Commit15001414
CreatedNov 6, 2020
ResolvedJan 6, 2021
UpdatedJan 12, 2021