diff --git a/src/lime/utils/ObjectPool.hx b/src/lime/utils/ObjectPool.hx index c26dff6e3..f7e82d1c6 100644 --- a/src/lime/utils/ObjectPool.hx +++ b/src/lime/utils/ObjectPool.hx @@ -120,6 +120,33 @@ import haxe.ds.ObjectMap; } } + public function remove(object:T):Void + { + if (__pool.exists(object)) + { + __pool.remove(object); + + if (__inactiveObject0 == object) + { + __inactiveObject0 = null; + inactiveObjects--; + } + else if (__inactiveObject1 == object) + { + __inactiveObject1 = null; + inactiveObjects--; + } + else if (__inactiveObjectList.remove(object)) + { + inactiveObjects--; + } + else + { + activeObjects--; + } + } + } + @:noCompletion private inline function __addInactive(object:T):Void { #if debug