CL 41643395 has introduced a crash. SGraphEditor::UpgradeDeprecatedDelegates creates 4 lambda wrappers to invoke the deprecated delegate in client code by binding to the newer non-deprecated version and calling the deprecated version.
We’re in the process of upgrading to 5.6 and we still have client code which is binding to the deprecated methods (in our case OnCreateActionMenu). When we right click in our editor widget it causes a crash because EventsToUpdate reference has now expired as the FGraphEditorEvents has gone out of scope. I’ve fixed this by changing the lambda capture to capture a copy, i.e:
if (EventsToUpdate.OnDropActor.IsBound() && !EventsToUpdate.OnDropActors.IsBound()) { EventsToUpdate.OnDropActors = FOnDropActors::CreateLambda([&EventsToUpdate](const TArray< TWeakObjectPtr<AActor> >& Actors, UEdGraph* InGraph, const FVector2f& InDropLocation) { EventsToUpdate.OnDropActor.Execute(Actors, InGraph, FVector2D(InDropLocation)); }); }
Changes to the following:
if (EventsToUpdate.OnDropActor.IsBound() && !EventsToUpdate.OnDropActors.IsBound()) { EventsToUpdate.OnDropActors = FOnDropActors::CreateLambda([OnDropActor=EventsToUpdate.OnDropActor](const TArray< TWeakObjectPtr<AActor> >& Actors, UEdGraph* InGraph, const FVector2f& InDropLocation) { OnDropActor.Execute(Actors, InGraph, FVector2D(InDropLocation)); }); }
Cheers!
-Steven