public T Release(HandleVector <T> .Handle handle) { if (isFree[handle.index]) { DebugUtil.LogErrorArgs("Tried to double free checked handle ", handle.index, "- Debug info:", debugInfo[handle.index]); } isFree[handle.index] = true; return(handleVector.Release(handle)); }
protected bool Free(HandleVector <int> .Handle handle, int last_idx, out int free_component_idx) { free_component_idx = -1; if (!handle.IsValid()) { return(false); } free_component_idx = handles.Release(handle); if (free_component_idx < last_idx) { int num = dataHandleIndices[last_idx]; if (handles.Items[num] != last_idx) { DebugUtil.LogErrorArgs("KCompactedVector: Bad state after attempting to free handle", handle.index); } handles.Items[num] = free_component_idx; dataHandleIndices[free_component_idx] = num; } dataHandleIndices.RemoveAt(last_idx); return(true); }