Destroying transient actor modifies parent and dirties package

Spawn a transient actor, attach it to a normal actor in the level, trigger a destroy on the transient actor, notice that the level is dirtied and prompts for save.

The underlying USceneComponent::DetachFromComponent used to detach does check the transient flag, but the enclosing UWorld::DestroyActor does not and does OldParentActor->Modify();
If I detach the transient actor first using DetachFromActor, then destroy it, it behaves as expected.

Code to spawn actor:
//spawn transient, deferred, hidden
FActorSpawnParameters asp;
asp.ObjectFlags = RF_Transient;
asp.bHideFromSceneOutliner = true;
asp.bDeferConstruction = true;
FTransform t(local_placement);
pactor = GetWorld()->SpawnActor( ptemplate->GeneratedClass, &t, asp );

//finish spawn/attach to level actor later…
pactor->AttachToActor( this, FAttachmentTransformRules::KeepRelativeTransform );
UGameplayStatics::FinishSpawningActor( pactor );

Code to remove the transient actor:
pactor->DetachFromActor( … ); //OMIT THIS LINE TO REPRO
pactor->Destroy( false, false );

1 Like