If parent window A passes a reference to itself to child window B (via constructor) so that B can set its Owner property to A, does that mean child window B won’t be garbage collected because parent window A stays alive for the duration of the application?
If this is the case, what is the best approach for creating clean parent/child relationships between WPF windows? Is there a concept of weak references for this type of relationship?
UPDATE: Brain FAIL. Okay, I shouldn’t have asked this question so late in the afternoon. I was over-complicating the problem. My brain reversed the logic of the GC and was thinking the child couldn’t collect because it referenced something else which is totally false. Thanks to all who answered anyway.
I created the Windows you mention, and added some code:
Once B had been closed and the second button pressed, the destructor ran. Hopefully this answers the question.