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