Access Violation When Trying To Create TSharedPtr of (this)Object

Diddykonga
Sat, 30 Apr 2016 13:17:25 +0000
C++

// Parse the folders array
const TArray<TSharedPtr>* FolderDescriptors;
if (Tree->TryGetArrayField(TEXT(“folder”), /out/ FolderDescriptors))
{
for (TSharedPtr FolderDescriptor : *FolderDescriptors)
{
TSharedPtr Folder = TSharedPtr(new FSpriterFolder());
Folders.Add(Folder);

		const bool bParsedFolderOK = Folder->ParseFromJSON(TSharedPtr<FSpriterSCON>(this), FolderDescriptor->AsObject(), NameForErrors, bSilent);
		bSuccessfullyParsed = bSuccessfullyParsed && bParsedFolderOK;
	}
}

Heres the code that is creating the Access Violation.

It happens when I try to pass a TSharedPtr to the ParseFromJSON method.

I need to pass the Current Object(FSpriterSCON) to the Folder(FSpriterFolder), how would i do this using Smart Pointers?

5 posts - 1 participant