private void EvacuateHostDialog_FormClosed(object sender, FormClosedEventArgs e) { vmErrorsAction?.Cancel(); hostAction?.Cancel(); if (_host != null) { _host.PropertyChanged -= hostUpdate; } if (_pool != null) { _pool.PropertyChanged -= poolUpdate; } foreach (var h in connection.Cache.Hosts) { h.PropertyChanged -= host_PropertyChanged; } foreach (DataGridViewRow row in dataGridViewVms.Rows) { if (row is VmPrecheckRow precheckRow) { DeregisterVmRowEvents(precheckRow); precheckRow.SolutionAction?.Cancel(); } } if (elevatedSession != null && elevatedSession.opaque_ref != null) { // NOTE: This doesnt happen currently, as we always scan once. Here as cheap insurance. // we still have the session from the role elevation dialog // it hasn't been used by an action so needs to be logged out elevatedSession.logout(); } }