void SFTPTreeView::OnEditorClosing(wxCommandEvent& evt) { evt.Skip(); IEditor* editor = (IEditor*)evt.GetClientData(); SFTPClientData* pcd = dynamic_cast<SFTPClientData*>(editor->GetClientData("sftp")); if(pcd) { // A file opened by SFTP, remove it from the current session SFTPSessionInfo& sess = GetSession(false); if(sess.IsOk()) { sess.RemoveFile(pcd->GetRemotePath()); m_sessions.Save(); } } }