Resets object on return instead of on rent.
This commit is contained in:
@@ -28,7 +28,6 @@ namespace Cryville.Common.Buffers {
|
|||||||
_objs[_index++] = null;
|
_objs[_index++] = null;
|
||||||
}
|
}
|
||||||
if (obj == null) obj = Construct();
|
if (obj == null) obj = Construct();
|
||||||
else Reset(obj);
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -36,7 +35,10 @@ namespace Cryville.Common.Buffers {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj">The object to return.</param>
|
/// <param name="obj">The object to return.</param>
|
||||||
public void Return(T obj) {
|
public void Return(T obj) {
|
||||||
if (_index > 0) _objs[--_index] = obj;
|
if (_index > 0) {
|
||||||
|
Reset(obj);
|
||||||
|
_objs[--_index] = obj;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs a new instance of type <typeparamref name="T" />.
|
/// Constructs a new instance of type <typeparamref name="T" />.
|
||||||
|
|||||||
Reference in New Issue
Block a user