Handle events before destroying objects

Register event handlers with the object manager, and fire the events
from within DiscardObjects before discarding any objects.

This mitigates problems where event handlers fired in global destruction,
after the object manager already had been garbage-collected
Sorry @moritz, I still wonder if there can be side effets by the references we have here. What if an even triggering object is also managed by the OM? If it is supposed to be discarded/renewed somewhere before the destruction, the reference here would prevent it from being destroyed, no?
Should we use weak references?
Regards, mg