[Crash] Modify a C++ struct that is split in a macro input pin

  1. Create a C++ struct
  2. Create a blueprint macro that takes said struct as input
  3. Use the macro in some blueprint
  4. Split the struct pin inside the macro
  5. Add a new BlueprintReadWrite property to the struct
  6. Editor will produce an out-of-bounds crash at UK2Node::ExpandSplitPin().

Hi pedro,

What version of the Engine are you using, and is it a binary version installed by the Launcher or did you build the Engine from source code? I tried testing this using the steps you provided in version 4.5.1 from source code and was not able to get the Editor to crash.

Would you be able to provide the callstack and logs from when the Editor crashes?

I’m using 4.5.1, built form github.

I tried to reproduce the problem with a brand new macro but it didn’t work at first. However, after I added multiple output execution pins and connected them in the macro call it did crash. The callstack is very long, since it’s during the initial blueprint compilation, so here’s the relevant parts:

>	UE4Editor-BlueprintGraph.dll!UK2Node::ExpandSplitPin(FKismetCompilerContext * CompilerContext, UEdGraph * SourceGraph, UEdGraphPin * Pin) Line 601	C++
 	UE4Editor-BlueprintGraph.dll!UEdGraphSchema_K2::CollapseGatewayNode(UK2Node * InNode, UEdGraphNode * InEntryNode, UEdGraphNode * InResultNode, FKismetCompilerContext * CompilerContext) Line 4663	C++
 	UE4Editor-KismetCompiler.dll!FKismetCompilerContext::ExpandTunnelsAndMacros(UEdGraph * SourceGraph) Line 2892	C++
 	UE4Editor-KismetCompiler.dll!FKismetCompilerContext::ExpansionStep(UEdGraph * Graph, bool bAllowUbergraphExpansions) Line 2439	C++
 	UE4Editor-KismetCompiler.dll!FKismetCompilerContext::CreateAndProcessUbergraph() Line 2602	C++
 	UE4Editor-KismetCompiler.dll!FKismetCompilerContext::CreateFunctionList() Line 2997	C++

The problem seems to be that UK2Node::ExpandSplitPin() receives a UEdGraphPin with the old number of structure pins from before the change, but it creates the expanded node with the new number of pins, resulting in an out-of-bounds access when it tries to connect the pins internally.

I am still having trouble reproducing this crash. This is the struct that I am using, with the TestThis variable being the one that I have added after creating the Blueprint:

USTRUCT(BlueprintType)
struct FTestStruct : public FTableRowBase
{
	GENERATED_USTRUCT_BODY()

public:

	FTestStruct()
		: TestVar1(0)
		, TestVar2(0)
		, TestThis(0.f)
	{}

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Test")
		int32 TestVar1;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Test")
		int32 TestVar2;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Test")
		float TestThis;
};

My Macro looks like this:

My Blueprint Event Graph looks like this:

How do these differ from what you have?

Between steps 5 and 6 in your repro steps, are you compiling the code in Visual Studio or the Editor? If in Visual Studio, is the Editor still open? What is the last thing you do before the crash occurs?

Hi pedro,

We have not heard from you for a while. Are you still having trouble with this issue? I will be marking this issue as resolved for tracking purposes. If you still need any assistance, please let us know. Any new comments on this post will re-open it.

I couldn’t reproduce it anymore. It seems there are other steps required to trigger the crash that I haven’t managed to identify (this crash might be the side effect of an error that happened elsewhere).

We can keep this flagged as solved.