Closed freehuntx closed 5 months ago
This type of check should not bee implemented into TArray::IsValid()
directly. If some usage of IsValid
is prone to to crashes on accessing an invalid Data
pointer, the check should be added inline.
Furthermore you are using the two parameter WinAPI IsBadReadPtr
instead of the one from Utils.h. The WinAPI function is deprecated (as mentioned in the docs) and should not be used.
Using IsBadReadPtr improves stability and prevents crashes all over the place.
What do you mean by this? This sentence implies that the current implementation of TArray::IsValid()
causes stability issues and triggers crashes in several different locations.
This is in direct opposition to my experience with IsValid()
. I have tested a lot of games and never encountered any situation in which the current implementation degraded stability or caused crashes.
In Mordhau i often had the situation, if i iterate over the equipments (TArray) i sometimes get into unreadable locations even when the playercharacter is checked for validity. Just this check managed to fix this. But lets just ditch the PR then.
Using IsBadReadPtr improves stability and prevents crashes all over the place.