Quantcast
Channel: General - Epic Developer Community Forums
Viewing all articles
Browse latest Browse all 9425

[CRASH] Instanced UObject inside struct inside sparse class data crashes

$
0
0

I encounter a really frustrating crash when declaring an instanced UObject inside a struct inside a sparse class data. The crashes occur when selecting the instanced class inside the instanced UObject dropdown (EffectTemplates). Since, gameplay ability are mean’t to be instanced, and gameplay effect can be shared, placing the schema definition inside of the ability itself is not okay.

USTRUCT(BlueprintType)
struct FMyGameAbilityEffectSchema
{
	GENERATED_BODY()

public:
	FMyGameAbilityEffectSchema() {}

	/** List of gameplay effects to apply to the targets */
	UPROPERTY(EditAnywhere, Instanced)
	TArray<TObjectPtr<UMyGameEffectBase>> EffectTemplates;
}

...
}

USTRUCT(BlueprintType)
struct MYGAME_API FMyGameAbilityBaseClassData
{
	GENERATED_BODY()
public:
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "MyGame", meta = (DisplayPriority = 0))
	TArray<FMyGameAbilityEffectSchema> EffectSchemas;
};


UCLASS(meta = (PrioritizeCategories = "MyGame", AutoCollapseCategories="MyGame|Internal"), SparseClassDataTypes = MyGameAbilityBaseClassData)
class MYGAME_API UMyGameAbilityBase : public UGameplayAbility
{
	GENERATED_BODY()

public:
}

The problem is caused in FObjectPropertyNode::GetReadAddressUncached, (ObjectPropertyNode.cpp) since this method adds a null for the EffectTemplates property. Subsequently, the null is dereferenced inside FItemPropertyNode (ItemPropertyNode.cpp)

bool FObjectPropertyNode::GetReadAddressUncached(const FPropertyNode& InNode,
											   bool InRequiresSingleSelection,
											   FReadAddressListData* OutAddresses,
											   bool bComparePropertyContents,
											   bool bObjectForceCompare,
											   bool bArrayPropertiesCanDifferInSize) const

			// We've got some addresses, and we know they're all NULL or non-NULL.
			// Have a peek at the first one, and only build an objects node if we've got addresses.
			if( UObject* Obj = (ReadAddresses.Num() > 0) ? ObjectProperty->GetObjectPropertyValue(ReadAddresses.GetAddress(0)) : nullptr )
>	UnrealEditor-CoreUObject.dll!FObjectProperty::GetObjectPropertyValue(const void * PropertyValueAddress) Line 329	C++
 	UnrealEditor-PropertyEditor.dll!FObjectPropertyNode::GetReadAddressUncached(const FPropertyNode & InNode, bool InRequiresSingleSelection, FReadAddressListData * OutAddresses, bool bComparePropertyContents, bool bObjectForceCompare, bool bArrayPropertiesCanDifferInSize) Line 364	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::GetReadAddressUncached(const FPropertyNode & InPropertyNode, bool InRequiresSingleSelection, FReadAddressListData * OutAddresses, bool bComparePropertyContents, bool bObjectForceCompare, bool bArrayPropertiesCanDifferInSize) Line 1460	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::GetReadAddressUncached(const FPropertyNode & InPropertyNode, bool InRequiresSingleSelection, FReadAddressListData * OutAddresses, bool bComparePropertyContents, bool bObjectForceCompare, bool bArrayPropertiesCanDifferInSize) Line 1460	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::GetReadAddressUncached(const FPropertyNode & InPropertyNode, bool InRequiresSingleSelection, FReadAddressListData * OutAddresses, bool bComparePropertyContents, bool bObjectForceCompare, bool bArrayPropertiesCanDifferInSize) Line 1460	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::InitNode(const FPropertyNodeInitParams & InitParams) Line 165	C++
 	UnrealEditor-PropertyEditor.dll!FItemPropertyNode::InitChildNodes() Line 258	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::RebuildChildren() Line 333	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::InitNode(const FPropertyNodeInitParams & InitParams) Line 261	C++
 	UnrealEditor-PropertyEditor.dll!FCategoryPropertyNode::InitChildNodes() Line 108	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::RebuildChildren() Line 333	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::InitNode(const FPropertyNodeInitParams & InitParams) Line 261	C++
 	UnrealEditor-PropertyEditor.dll!FObjectPropertyNode::InternalInitChildNodes(FName SinglePropertyName) Line 668	C++
 	UnrealEditor-PropertyEditor.dll!FObjectPropertyNode::InitChildNodes() Line 459	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::RebuildChildren() Line 333	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::InitNode(const FPropertyNodeInitParams & InitParams) Line 261	C++
 	UnrealEditor-PropertyEditor.dll!FItemPropertyNode::InitChildNodes() Line 427	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::RebuildChildren() Line 333	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::EnsureDataIsValid() Line 756	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::EnsureDataIsValid() Line 781	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::EnsureDataIsValid() Line 781	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::EnsureDataIsValid() Line 781	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::EnsureDataIsValid() Line 781	C++
 	UnrealEditor-PropertyEditor.dll!FPropertyNode::EnsureDataIsValid() Line 781	C++
 	UnrealEditor-PropertyEditor.dll!SDetailsViewBase::Tick(const FGeometry & AllottedGeometry, const double InCurrentTime, const float InDeltaTime) Line 1222	C++
 	UnrealEditor-SlateCore.dll!SWidget::Paint(const FPaintArgs & Args, const FGeometry & AllottedGeometry, const FSlateRect & MyCullingRect, FSlateWindowElementList & OutDrawElements, int LayerId, const FWidgetStyle & InWidgetStyle, bool bParentEnabled) Line 1483	C++
 	UnrealEditor-SlateCore.dll!SPanel::PaintArrangedChildren(const FPaintArgs & Args, const FArrangedChildren & ArrangedChildren, const FGeometry & AllottedGeometry, const FSlateRect & MyCullingRect, FSlateWindowElementList & OutDrawElements, int LayerId, const FWidgetStyle & InWidgetStyle, bool bParentEnabled) Line 31	C++
 	UnrealEditor-SlateCore.dll!SPanel::OnPaint(const FPaintArgs & Args, const FGeometry & AllottedGeometry, const FSlateRect & MyCullingRect, FSlateWindowElementList & OutDrawElements, int LayerId, const FWidgetStyle & InWidgetStyle, bool bParentEnabled) Line 12	C++
 	UnrealEditor-SlateCore.dll!SWidget::Paint(const FPaintArgs & Args, const FGeometry & AllottedGeometry, const FSlateRect & MyCullingRect, FSlateWindowElementList & OutDrawElements, int LayerId, const FWidgetStyle & InWidgetStyle, bool bParentEnabled) Line 1622	C++
 	UnrealEditor-Slate.dll!SBox::OnPaint(const FPaintArgs & Args, const FGeometry & AllottedGeometry, const FSlateRect & MyCullingRect, FSlateWindowElementList & OutDrawElements, int LayerId, const FWidgetStyle & InWidgetStyle, bool bParentEnabled) Line 293	C++
 	UnrealEditor-SlateCore.dll!SWidget::Paint(const FPaintArgs & Args, const FGeometry & AllottedGeometry, const FSlateRect & MyCullingRect, FSlateWindowElementList & OutDrawElements, int LayerId, const FWidgetStyle & InWidgetStyle, bool bParentEnabled) Line 1622	C++
 	UnrealEditor-SlateCore.dll!SPanel::PaintArrangedChildren(const FPaintArgs & Args, const FArrangedChildren & ArrangedChildren, const FGeometry & AllottedGeometry, const FSlateRect & MyCullingRect, FSlateWindowElementList & OutDrawElements, int LayerId, const FWidgetStyle & InWidgetStyle, bool bParentEnabled) Line 31	C++
 	UnrealEditor-SlateCore.dll!SPanel::OnPaint(const FPaintArgs & Args, const FGeometry & AllottedGeometry, const FSlateRect & MyCullingRect, FSlateWindowElementList & OutDrawElements, int LayerId, const FWidgetStyle & InWidgetStyle, bool bParentEnabled) Line 12	C++
 	UnrealEditor-SlateCore.dll!SWidget::Paint(const FPaintArgs & Args, const FGeometry & AllottedGeometry, const FSlateRect & MyCullingRect, FSlateWindowElementList & OutDrawElements, int LayerId, const FWidgetStyle & InWidgetStyle, bool bParentEnabled) Line 1622	C++

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 9425

Trending Articles