Description

Calling a code defined function in blueprints that returns a TWeakObjectPtr causes a crash.

Steps to Reproduce

1. Open UE4 Editor
2. Add code to project based on Actor (AMyActor)
3. In the header file add the following:

UFUNCTION(BlueprintCallable, Category="test")
 TWeakObjectPtr<AActor> ReturnWeakObject();

4. In the source file add the following:

TWeakObjectPtr<AActor> AMyActor::ReturnWeakObject()
 {
     auto Actor = GetWorld()->SpawnActor<AStaticMeshActor>();
     return TWeakObjectPtr<AActor>(Actor);
 }

5. Compile
6. Create blueprint based on AMyActor
7. Enable Input on Begin Play
8. Add WeakObjectPtr node and connect to key press event (T)
9. PIE and press T

Result:
Editor immediately crashes

Have Comments or More Details?

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

0
Login to Vote

Fixed
ComponentUE - Gameplay - Blueprint
Affects Versions4.7.34.8
Target Fix4.8
Fix Commit2499396
CreatedMar 20, 2015
ResolvedApr 2, 2015
UpdatedApr 27, 2018
View Jira Issue