# How to properly use SListView with a of structs?

**URL:** <https://forums.unrealengine.com/t/how-to-properly-use-slistview-with-a-of-structs/312406>\
**Category:** UI\
**Tags:** Struct, unreal-engine, crash, slate, CPP, question\
**Created:** [March 24, 2015, 5:06pm UTC](https://forums.unrealengine.com/t/how-to-properly-use-slistview-with-a-of-structs/312406 "2015-03-24T17:06:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elringus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/elringus/32/1017568_2.png) [@Elringus](https://forums.unrealengine.com/u/Elringus)\
**Post date:** [March 24, 2015, 5:06pm UTC](https://forums.unrealengine.com/t/how-to-properly-use-slistview-with-a-of-structs/312406/1 "2015-03-24T17:06:03Z")

</div>

I have the following array, which I want to render as a slate list:

```
TArray<FArtifact> Artifacts;

```

As far as I know, SListView can only be used with an array of pointers to UObject, shared refs and shared pointers. So, as in my case it is structs, I will have to somehow convert my array to an array of either TSharedPtr\< FArtifact \> or TSharedRef\< FArtifact \>. I’ve tried something like that:

```
// Array to keep shared pointers to my structs
TArray<TSharedPtr<FArtifact>> ArtifactsPtrs;
// Creating shared pointers to the original objects
for (auto Artifact : Artifacts)
	ArtifactsPtrs.Add(MakeShareable(&Artifact));
// Trying to construct SListView
SNew(SListView<TSharedPtr<FArtifact>>)
	.ListItemsSource(&ArtifactsPtrs)
	.OnGenerateRow_Lambda([](TSharedPtr<FArtifact> Artifact, const TSharedRef<STableViewBase>& OwnerTable)->TSharedRef<ITableRow>{ return SNew(STableRow<TSharedPtr<FArtifact>>, OwnerTable)[SNew(STextBlock).Text(Artifact->Name)]; })

```

It compiles OK, but on run, I have editor crash with the following log (in the attachment).  
I’ve spend the whole day trying to make it work, but no luck so far ☹

Would very appreciate any hints, thank you!

---

<div class="post-metadata">

**Author:** ![Elringus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/elringus/32/1017568_2.png) [@Elringus](https://forums.unrealengine.com/u/Elringus)\
**Post date:** [March 25, 2015, 5:53pm UTC](https://forums.unrealengine.com/t/how-to-properly-use-slistview-with-a-of-structs/312406/2 "2015-03-25T17:53:53Z")

</div>

It appears that the problem was with creating the array of shared pointers: I’ve used pointers to the items in the original array to populate it, which seems to cause some memory-related problems. Instead, I should have created new structures with the same properties as the original ones to populate the array:

```
for (auto Artifact : Artifacts)
    ArtifactsPtrs.Add(MakeShareable(new FArtifact(Artifact.Name));

```
