I am writing plugins for Unreal Engine 4 and I have noticed something strange about using widget Slots. for example when you write
+ SHorizontalBox::Slot()
this is being called
static FSlot& Slot()
{
return *(new FSlot());
}
can you find where this pointer is deleted? I could find nothing. the +
operator for adding slots is given to you by this macro
SLATE_BEGIN_ARGS(SHorizontalBox)
...
SLATE_SUPPORTS_SLOT(SHorizontalBox::FSlot)
...
SLATE_END_ARGS(SHorizontalBox)
which becomes
TArray< SHorizontalBox::FSlot* > Slots;
WidgetArgsType& operator + (SHorizontalBox::FSlot& SlotToAdd)
{
Slots.Add( &SlotToAdd );
return *this;
}
and that’s all there is.
Now I’m wondering when this slot object allocated on heap is destroyed? does TArray automatically delete pointers? how?