Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  [FIXED] Dispose of atomic safety handle error when game start
#10
Dedo arriba 
(01-12-2023, 08:57 AM)josemendez Wrote: Some concrete implementations of ObiNativeList<T> override/hide the parameterless constructor, as it's not supposed to do anything even when called by Unity. These are lists of data types that get serialized as part of assets (mainly, actor blueprints).


I'm not sure I understand your explanation, ChangeCapacity is not only called by the list's constructor. It is also called when adding individual elements or a range of elements to the list, basically in any situation that we need to actually store something in the list.

As a result, even if the constructor is not called isCreated will be set true as soon as the list is used for the first time. As far as I can tell, there's no situation in which isCreated can be be false and the safety handle to exist simultaneously, leading to a leak.

However if the constructor is not called (and the safety handle is hence invalid) but Dispose is called, it will attempt to destroy a handle that doesn't exist. This is what Unity does and why making the safety handle destruction code depend on isCreated is correct.

kind regards


Thank you again for your quick response.
Thank you for your detailed answer. I believe I have no further questions.
Reply


Messages In This Thread
RE: Dispose of atomic safety handle error when game start - by kaser - 01-12-2023, 09:09 AM