I’ve got a real odd one here. I have a c++ class that inherits from UObject called “UnrealSegment”. This class essentially acts as a container for some data that I’m grabbing via an http request. I have an instance of this class in an actor component I call “Segment Manager” In the segment manager constructor, I use NewObject<UUnrealSegment>();
to initialize the Unreal segment instance and then I actually set the data in the http request response like so:
if (segment.ParseFromArray(data.GetData(), data.Num())) {
testUnrealSegment->m_startTime = segment.interval().start();
testUnrealSegment->m_endTime = segment.interval().end();
testUnrealSegment->m_textureURL = segment.external().url().c_str();
testUnrealSegment->m_meshlistURL = segment.external_mesh_list().url().c_str();
testUnrealSegment->m_audioPBURL = Request->GetHeader("_audioURL");
UE_LOG(LogTemp, Warning, TEXT("Data fed into Unreal Segment:"));
UE_LOG(LogTemp, Warning, TEXT("Segment start: %i seconds"), (int)testUnrealSegment->m_startTime.seconds());
UE_LOG(LogTemp, Warning, TEXT("Segment end: %i seconds"), (int)testUnrealSegment->m_endTime.seconds());
//UE_LOG(LogTemp, Warning, TEXT("Texture URL: %s"), *testUnrealSegment->m_textureURL);
UE_LOG(LogTemp, Warning, TEXT("Mesh list URL: %s"), *testUnrealSegment->m_meshlistURL);
UE_LOG(LogTemp, Warning, TEXT("audio URL: %s"), *testUnrealSegment->m_audioPBURL);
} else {
UE_LOG(LogTemp, Error, TEXT("Unable to parse segment"));
}
The problem is, I’ve found through stepping through the code that changing m_textureURL causes unreal to crash with “EXCEPTION_ACCESS_VIOLATION”. All other parts of this are fine, and I can take segment.external().url().c_str()
and put it into any of the other FString variables of the Unreal Segment, I can comment out the line that assigns to m_textureURL and it all runs fine. It is just m_textureURL in particular that is bad. I tried adding another FString variable to use instead but that made both m_textureURL and m_audioPBURL cause Unreal to crash so this is making me think this is some sort of memory allocation error. Any help would be appreciated on this. I can’t imagine why this is causing such a problem.