/// <summary> /// Safely disposes of several objects. /// </summary> public void Cleanup() { completionForm.FocusOutEvent -= OnLeaveCompletion; completionView.ButtonPressEvent -= OnButtonPress; completionView.KeyPressEvent -= OnContextListKeyDown; completionView.KeyReleaseEvent -= OnKeyRelease; if (completionForm.IsRealized) { completionForm.Cleanup(); } completionView.Cleanup(); completionForm.Cleanup(); completionForm = null; }