This method will crash if the user of the control has deleted it in response to OnSelectionChanged event, e.g. when selecting a ComboBox option closes a dialog. This effectively invalidates the shared pointer to ComboBoxContent.
void UComboBoxString::HandleSelectionChanged(TSharedPtr<FString> Item, ESelectInfo::Type SelectionType)
{
CurrentOptionPtr = Item;
SelectedOption = CurrentOptionPtr.IsValid() ? CurrentOptionPtr.ToSharedRef().Get() : FString();
if ( !IsDesignTime() )
{
OnSelectionChanged.Broadcast(Item.IsValid() ? *Item : FString(), SelectionType);
}
// When the selection changes we always generate another widget to represent the content area of the comobox.
ComoboBoxContent->SetContent( HandleGenerateWidget(CurrentOptionPtr) );
}
Last line should be changed to:
if (ComboBoxContent.IsValid())
{
ComoboBoxContent->SetContent( HandleGenerateWidget(CurrentOptionPtr) );
}