Improve detection of refcounting when using AsSingleton

Issue #237 open
Stefan Glienke repo owner created an issue

Currently the container does a very simple analysis if a class implements ref counting or not (check if inherits from TInterfacedObject).

This can lead to registration defects if the class does not inherit from TInterfacedObject but implements ref counting as the container then mistakenly stores the object reference and manually destroys it in the end (whereas it should only keep an interface reference)

Comments (6)

  1. Vincent Parrett

    I just hit this issue, spent several hours fighting with the 10.4 debugger to figure out what the cause was!
    Perhaps one way do improve this would be to allow the registration of base classes that implement reference counting?

  2. Log in to comment