Reading about the Weak Event Patterns it is clear to me that it allows for garbage collecting the listener
when it is not longer referenced but is the reciprocal true also ? Meaning does this pattern allows for garbage collecting the source
when it is no longer referenced (except via attached weak listener
) ?
Why am I asking this: I want to implement a CopyOnWrite pattern between some "source" and "listener" where the second one is just a subset of the first one. So I need to "detach" whenever one write to the source/listener or when the source disappears (because no need to keep a large amount of data while only a subset is still referenced). So I need very loose coupling between the source and the listener (i.e. letting them both be garbage collected whenever one or the other is no longer strongly referenced).