I have a class that needs to perform specific actions. Based on the input data, some dialogs might be shown. These dialogs need to be invoked with the parent window's handle so that they're centered correctly etc.
private IntPtr _parentWindow;
...
System.Windows.Forms.MessageBox.Show(System.Windows.Forms.Control.FromHandle(_parentWindow), "message");
After the parent form is ultimately closed, my class's instance still exists, with _parentWindow still assigned with a value.
Is this safe to do? Or would the GC not fully dispose the form on account of _parentWindow being populated with the handle?