get_it icon indicating copy to clipboard operation
get_it copied to clipboard

`ignoreReferenceCount` parameter in unregister method is not used

Open z-chu opened this issue 8 months ago • 0 comments

In the unregister method, there is a parameter ignoreReferenceCount which is defined but not used in the implementation.

Current implementation:

if (factoryToRemove._referenceCount > 0) {
  factoryToRemove._referenceCount--;
  return;
}

The ignoreReferenceCount parameter should be used to control whether to ignore the reference count when unregistering. I suggest modifying the code to:

if (!ignoreReferenceCount && factoryToRemove._referenceCount > 0) {
  factoryToRemove._referenceCount--;
  return;
}

This would make the parameter work as expected:

  • When ignoreReferenceCount = false (default): keep current behavior
  • When ignoreReferenceCount = true: it will ignore the reference count and unregister the object

z-chu avatar Apr 12 '25 16:04 z-chu