Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access violation when reading name #2

Open
MicalKarl opened this issue Oct 19, 2023 · 4 comments
Open

access violation when reading name #2

MicalKarl opened this issue Oct 19, 2023 · 4 comments

Comments

@MicalKarl
Copy link

MicalKarl commented Oct 19, 2023

FAView TempMemoryPool::NToA(FName Name) {
	const FNameEntry* NameEntry = Name.GetDisplayNameEntry();
	if (NameEntry->IsWide())
		return "<WideFNameError>";

Error occurs at NameEntry->IsWide() where the Name value shows Illegal name (block index out of range)_3

I guess the errs might be Ptr or StructPtr is invalid in the bellowing code.

FName PropertyItem::GetName() {
	if (Type == PointerType::Property && Prop)
		return Prop->GetFName();

	if (Type == PointerType::Object && Ptr)
		return ((UObject*)Ptr)->GetFName();

	if (StructPtr && (Type == PointerType::Struct || Type == PointerType::Function))
		return StructPtr->GetFName();
		//return StructPtr->GetAuthoredName();

	return NAME_None;
}
@guitarfreak
Copy link
Owner

Thank you for the bug report! (And sorry for the crash.) I will look at it on the weekend at the latest.
Is there an easy way for me to reproduce the crash? What kind of object did you look at in the watch window?

@MicalKarl
Copy link
Author

Thank you for the bug report! (And sorry for the crash.) I will look at it on the weekend at the latest. Is there an easy way for me to reproduce the crash? What kind of object did you look at in the watch window?

Thanks for your reply! I encountered this issue when clicking the properties of an actor deeply like a player state (I forget which type of actor it is), but I remember the issue property type is an Object type, I fixed it myself with a TWeakObjectPtr check when using PropertyItem::GetName() function.

@guitarfreak
Copy link
Owner

Interesting, we do check if a TWeakObjectPtr is stale before drawing it.

} else if (FWeakObjectProperty* WeakObjProp = CastField<FWeakObjectProperty>(Item.Prop)) {
	TWeakObjectPtr<UObject>* WeakPtr = (TWeakObjectPtr<UObject>*)Item.Ptr;
	if (WeakPtr->IsStale())
		ImGui::Text("<Stale>");
	if (!WeakPtr->IsValid())
		ImGui::Text("<Null>");
	else {
		auto NewItem = MakeObjectItem(WeakPtr->Get());
		DrawPropertyValue(NewItem);
	}

Maybe it got destroyed while DrawPropertyValue happened? If that's possible I would have to restructure the code a bit, because currently only the raw object pointer gets passed down without the "weak" part.
How did you fix it exactly?

@MicalKarl
Copy link
Author

Interesting, we do check if a TWeakObjectPtr is stale before drawing it.

} else if (FWeakObjectProperty* WeakObjProp = CastField<FWeakObjectProperty>(Item.Prop)) {
	TWeakObjectPtr<UObject>* WeakPtr = (TWeakObjectPtr<UObject>*)Item.Ptr;
	if (WeakPtr->IsStale())
		ImGui::Text("<Stale>");
	if (!WeakPtr->IsValid())
		ImGui::Text("<Null>");
	else {
		auto NewItem = MakeObjectItem(WeakPtr->Get());
		DrawPropertyValue(NewItem);
	}

Maybe it got destroyed while DrawPropertyValue happened? If that's possible I would have to restructure the code a bit, because currently only the raw object pointer gets passed down without the "weak" part. How did you fix it exactly?

I fix it simply by when construting the PropertyItem struct, add a TWeakObjectPtr to watch if it is a uobject. When it comes to use the raw _Ptr value, check it if valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants