I've managed to find the reason why some TTObject instances was still alive after the deletion of a patcher.
the reason is not related to a bug of Foundation but more to a user case we maybe didn't figured out until now.
Many Modular TTObjects use to pass themself into a baton of a callback for directory observations.
For example in TTContainer class, when we bind on an address (in order to watch all the content below), we do :
mObserver = TTObject("callback");
baton = TTValue(TTObject(this), aContext);
accessApplicationLocalDirectory->addObserverForNotifications(mAddress, mObserver); // ask for notification for addresses below
But the problem is that until now I used to remove the observation into the ~TTContainer function which was never called as there is still an instance refered by the observer baton …
A solution would be to call a method to clear this observation mechanism but this sounds not user friendly to have to call something before deleting things.
Another solution would be to register this as a pointer into the baton with the risk to have unconsistant refcounting.
What do you think ?
is this a typical case you already resolved by some magic tricks ?