You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Over the years both @theod and I have been bitten some really difficult to track bugs stemming from pointers going out of scope or leaking in the observer and notification system. This is still at the heart of our worst AudioGraph problems that we need to solve.
I have two insights that together could revolutionize our system:
From C++11 smart pointers -- Objects being observed are all shared pointers. The objects that issue notifications can track them using weak pointers, which know when the underlying object goes away!
RAII -- An observer (let's call it TTObserver, assuming that name isn't taken) should be a class of it's own. An object which wishes to observe another object should create an instance of TTObserver. Then when it goes out of scope everything cleans up after itself neatly, unlike the wild west manual cleanup that happens currently (and problematically in some cases).
This implies that TTObject ref counting and other "smart pointer" stuff which we have implemented manually migrate to standard C++ smart pointers.
The text was updated successfully, but these errors were encountered:
+1 for smart_pointers !
and I never seen any object called TTObserver. Is this class isn't relative to the TTCallback class (which can be used to observe notifications send from another class) ? is the TTCallback will still be useful ?
I also mention that for the time being if I change an attribute I have to take care to notify its observers (which is normal but a bit convoluted : see here in TTData::notifyObservers)).
And finally why we don't have TTNotification class for a TTObject like we have TTAttribute and TTMessage ?
this would match the Max concept of parameter, message and return and maybe allow to move them directly at the TTObject level (for the record we currently need to create a TTData with @service equal to "parameter", "message" or "return"). Of course this will implies to move all the TTData internal processings inside what we call the TTAttribute "properties" with a smart design pattern to allow to choose which kind of processing we want to make on the values (repetition filtering, ramping, ...).
Over the years both @theod and I have been bitten some really difficult to track bugs stemming from pointers going out of scope or leaking in the observer and notification system. This is still at the heart of our worst AudioGraph problems that we need to solve.
I have two insights that together could revolutionize our system:
This implies that TTObject ref counting and other "smart pointer" stuff which we have implemented manually migrate to standard C++ smart pointers.
The text was updated successfully, but these errors were encountered: