Merge pull request #4808 from AenBleidd/vko_4793_proper_frame_delete

[Windows][Manager] Do proper verifications when saving state on application exit
This commit is contained in:
Vitalii Koshura 2022-06-24 14:31:43 +02:00 committed by GitHub
commit 4b08c5d194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 7 deletions

View File

@ -616,7 +616,7 @@ void CViewWork::OnShowItemProperties( wxCommandEvent& WXUNUSED(event) ) {
bool CViewWork::OnSaveState(wxConfigBase* pConfig) {
bool bReturnValue = true;
CMainDocument* pDoc = wxGetApp().GetDocument();
CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
@ -624,17 +624,24 @@ bool CViewWork::OnSaveState(wxConfigBase* pConfig) {
wxASSERT(m_pTaskPane);
wxASSERT(m_pListPane);
if (!m_pTaskPane->OnSaveState(pConfig)) {
if (!pConfig) {
return false;
}
if (!m_pTaskPane || !m_pTaskPane->OnSaveState(pConfig)) {
bReturnValue = false;
}
if (!m_pListPane->OnSaveState(pConfig)) {
if (!m_pListPane || !m_pListPane->OnSaveState(pConfig)) {
bReturnValue = false;
}
wxString strBaseConfigLocation = wxEmptyString;
strBaseConfigLocation = wxT("/Tasks");
pConfig->SetPath(strBaseConfigLocation);
pConfig->Write(wxT("ActiveTasksOnly"), (pDoc->m_ActiveTasksOnly ? 1 : 0));
if (pConfig && pDoc) {
const wxString strBaseConfigLocation = wxT("/Tasks");
pConfig->SetPath(strBaseConfigLocation);
pConfig->Write(wxT("ActiveTasksOnly"), (pDoc->m_ActiveTasksOnly ? 1 : 0));
} else {
bReturnValue = false;
}
return bReturnValue;
}