Description

If using a UHierarchicalInstancedStaticMeshComponent in a C++ class and adding instances via the OnConstruction( ) function, editor can crash.

Steps to Reproduce
  1. Download attached project and extract
  2. Right click .uproject, generate Visual Studio Project files
  3. Open .sln and debug game project as Development Editor
  4. Open THInstanceMesh_BP
  5. With "THInstanceMesh_BP(self)" selected in components, change Instance Count from 0.0 to 1.0
  6. Save and compile Blueprint
  7. Change Instance Count from 1.0 to 2.0
  8. Save and compile Blueprint

RESULT:

Editor will crash in FStaticMeshInstanceBuffer::Init( ).

EXPECTED:

Users can change number of UHierarchicalInstancedStaticMeshComponent without a crash.

Callstack
UE4Editor-Engine.dll!FStaticMeshInstanceBuffer::Init(UInstancedStaticMeshComponent * InComponent, const TArray<TRefCountPtr<HHitProxy>,FDefaultAllocator> & InHitProxies) Line 97	C++
UE4Editor-Engine.dll!FPerInstanceRenderData::FPerInstanceRenderData(UInstancedStaticMeshComponent * InComponent, ERHIFeatureLevel::Type InFeaureLevel) Line 352	C++
UE4Editor-Engine.dll!FInstancedStaticMeshRenderData::FInstancedStaticMeshRenderData(UInstancedStaticMeshComponent * InComponent, ERHIFeatureLevel::Type InFeatureLevel) Line 398	C++
UE4Editor-Engine.dll!FInstancedStaticMeshSceneProxy::FInstancedStaticMeshSceneProxy(UInstancedStaticMeshComponent * InComponent, ERHIFeatureLevel::Type InFeatureLevel) Line 539	C++
UE4Editor-Engine.dll!FHierarchicalStaticMeshSceneProxy::FHierarchicalStaticMeshSceneProxy(bool bInIsGrass, UHierarchicalInstancedStaticMeshComponent * InComponent, ERHIFeatureLevel::Type InFeatureLevel) Line 745	C++
UE4Editor-Engine.dll!UHierarchicalInstancedStaticMeshComponent::CreateSceneProxy() Line 2482	C++
UE4Editor-Renderer.dll!FScene::AddPrimitive(UPrimitiveComponent * Primitive) Line 633	C++
UE4Editor-Engine.dll!UActorComponent::ExecuteRegisterEvents() Line 1152	C++
UE4Editor-Engine.dll!UActorComponent::RegisterComponentWithWorld(UWorld * InWorld) Line 878	C++
UE4Editor-Engine.dll!AActor::IncrementalRegisterComponents(int NumComponentsToRegister) Line 3966	C++
UE4Editor-Engine.dll!AActor::RegisterAllComponents() Line 3905	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReplaceInstancesOfClass_Inner(TMap<UClass *,UClass *,FDefaultSetAllocator,TDefaultMapKeyFuncs<UClass *,UClass *,0> > & InOldToNewClassMap, UObject * InOriginalCDO, TSet<UObject *,DefaultKeyFuncs<UObject *,0>,FDefaultSetAllocator> * ObjectsThatShouldUseOldStuff, bool bClassObjectReplaced, bool bPreserveRootComponent) Line 1512	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReplaceInstancesOfClass(UClass * OldClass, UClass * NewClass, UObject * OriginalCDO, TSet<UObject *,DefaultKeyFuncs<UObject *,0>,FDefaultSetAllocator> * ObjectsThatShouldUseOldStuff, bool bClassObjectReplaced, bool bPreserveRootComponent) Line 1314	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReinstanceInner(bool bForceAlwaysReinstance) Line 608	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReinstanceObjects(bool bForceAlwaysReinstance) Line 770	C++
UE4Editor-UnrealEd.dll!FKismetEditorUtilities::CompileBlueprint(UBlueprint * BlueprintObj, bool bIsRegeneratingOnLoad, bool bSkipGarbageCollection, bool bSaveIntermediateProducts, FCompilerResultsLog * pResults, bool bSkeletonUpToDate, bool bBatchCompile, bool bAddInstrumentation) Line 795	C++
UE4Editor-Kismet.dll!FBlueprintEditor::Compile() Line 3216	C++
UE4Editor-Kismet.dll!TBaseSPMethodDelegateInstance<0,FBlueprintEditor,0,TTypeWrapper<void> __cdecl(void)>::Execute() Line 317	C++
UE4Editor-Kismet.dll!TBaseSPMethodDelegateInstance<0,FBlueprintEditor,0,void __cdecl(void)>::ExecuteIfSafe() Line 423	C++
UE4Editor-Slate.dll!FUICommandList::ExecuteAction(const TSharedRef<FUICommandInfo const ,0> InUICommandInfo) Line 92	C++
UE4Editor-Slate.dll!SToolBarButtonBlock::OnClicked() Line 300	C++
UE4Editor-Slate.dll!TMemberFunctionCaller<SToolBarButtonBlock,FReply (__cdecl SToolBarButtonBlock::*)(void) __ptr64>::operator()<>() Line 161	C++
UE4Editor-Slate.dll!TTupleImpl<TIntegerSequence<unsigned int> >::ApplyAfter<TMemberFunctionCaller<SToolBarButtonBlock,FReply (__cdecl SToolBarButtonBlock::*)(void) __ptr64> >(TMemberFunctionCaller<SToolBarButtonBlock,FReply (__cdecl SToolBarButtonBlock::*)(void)> && Func) Line 115	C++
UE4Editor-Slate.dll!TBaseSPMethodDelegateInstance<0,SToolBarButtonBlock,0,FReply __cdecl(void)>::Execute() Line 317	C++
UE4Editor-Slate.dll!TBaseDelegate<FReply>::Execute() Line 521	C++
UE4Editor-Slate.dll!SButton::OnMouseButtonUp(const FGeometry & MyGeometry, const FPointerEvent & MouseEvent) Line 278	C++
UE4Editor-Slate.dll!FSlateApplication::RoutePointerUpEvent::__l8::<lambda>(const FArrangedWidget & TargetWidget, const FPointerEvent & Event) Line 4901	C++
UE4Editor-Slate.dll!FEventRouter::Route<FReply,FEventRouter::FToLeafmostPolicy,FPointerEvent,FReply <lambda>(const FArrangedWidget &, const FPointerEvent &) >(FSlateApplication * ThisApplication, FEventRouter::FToLeafmostPolicy RoutingPolicy, FPointerEvent EventCopy, const FSlateApplication::RoutePointerUpEvent::__l8::FReply <lambda>(const FArrangedWidget &, const FPointerEvent &) & Lambda) Line 215	C++
UE4Editor-Slate.dll!FSlateApplication::RoutePointerUpEvent(FWidgetPath & WidgetsUnderPointer, FPointerEvent & PointerEvent) Line 4890	C++
UE4Editor-Slate.dll!FSlateApplication::ProcessMouseButtonUpEvent(FPointerEvent & MouseEvent) Line 5348	C++
UE4Editor-Slate.dll!FSlateApplication::OnMouseUp(const EMouseButtons::Type Button, const FVector2D CursorPos) Line 5328	C++
UE4Editor-Core.dll!FWindowsApplication::ProcessDeferredMessage(const FDeferredWindowsMessage & DeferredMessage) Line 1584	C++
UE4Editor-Core.dll!FWindowsApplication::DeferMessage(TSharedPtr<FWindowsWindow,0> & NativeWindow, HWND__ * InHWnd, unsigned int InMessage, unsigned __int64 InWParam, __int64 InLParam, int MouseX, int MouseY, unsigned int RawInputFlags) Line 1930	C++
UE4Editor-Core.dll!FWindowsApplication::ProcessMessage(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 747	C++
UE4Editor-Core.dll!FWindowsApplication::AppWndProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 669	C++
[External Code]	
UE4Editor-Core.dll!FWindowsPlatformMisc::PumpMessages(bool bFromMainLoop) Line 905	C++
UE4Editor.exe!FEngineLoop::Tick() Line 2788	C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 156	C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 191	C++
[External Code]	

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

1
Login to Vote

Cannot Reproduce
ComponentUE - Graphics Features
Affects Versions4.13.1
Target Fix4.15
CreatedOct 14, 2016
ResolvedNov 30, 2016
UpdatedApr 27, 2018