Fixed some crashing code in dialog cleanup in some exceptional cases

Fixed memory leak
Set return codes on the modal dialogs to avoid use of uninitialized values


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7929 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
George Tasker
2000-08-04 11:03:22 +00:00
parent 50dce4e225
commit 386cd1e43b

View File

@@ -401,19 +401,19 @@ void DatabaseDemoFrame::BuildEditorDialog()
pEditorDlg = NULL; pEditorDlg = NULL;
pEditorDlg = new CeditorDlg(this); pEditorDlg = new CeditorDlg(this);
if (pEditorDlg) if (pEditorDlg)
pEditorDlg->Initialize();
else
{ {
wxMessageBox("Unable to create the editor dialog for some reason","Error...",wxOK | wxICON_EXCLAMATION); pEditorDlg->Initialize();
DemoFrame->Close();
}
if (!pEditorDlg->initialized) if (!pEditorDlg->initialized)
{ {
pEditorDlg->Close(); pEditorDlg->Close();
pEditorDlg = NULL; delete pEditorDlg;
wxMessageBox("Unable to initialize the editor dialog for some reason","Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox("Unable to initialize the editor dialog for some reason","Error...",wxOK | wxICON_EXCLAMATION);
DemoFrame->Close(TRUE); DemoFrame->Close();
}
} else
{
wxMessageBox("Unable to create the editor dialog for some reason","Error...",wxOK | wxICON_EXCLAMATION);
DemoFrame->Close();
} }
} // DatabaseDemoFrame::BuildEditorDialog() } // DatabaseDemoFrame::BuildEditorDialog()
@@ -1481,10 +1481,16 @@ void CparameterDlg::OnCloseWindow(wxCloseEvent& event)
wxGetApp().params = savedParamSettings; wxGetApp().params = savedParamSettings;
} }
// if (GetParent() != NULL) if (GetParent() != NULL)
// GetParent()->SetFocus(); GetParent()->SetFocus();
this->Destroy();
while (wxIsBusy())
wxEndBusyCursor();
Show(FALSE);
SetReturnCode(0); // added so BoundsChecker would not report use of uninitialized variable
this->Destroy();
} // CparameterDlg::OnCloseWindow() } // CparameterDlg::OnCloseWindow()
@@ -1641,6 +1647,8 @@ void CparameterDlg::FillDataSourceList()
int i; int i;
for (i = 0; wxStrlen(p[i]); i++) for (i = 0; wxStrlen(p[i]); i++)
pParamODBCSourceList->Append(p[i]); pParamODBCSourceList->Append(p[i]);
delete p;
} // CparameterDlg::CparameterDlg::FillDataSourceList() } // CparameterDlg::CparameterDlg::FillDataSourceList()
@@ -2005,8 +2013,9 @@ void CqueryDlg::OnCloseWindow(wxCloseEvent& event)
wxEndBusyCursor(); wxEndBusyCursor();
Show(FALSE); Show(FALSE);
this->Destroy(); SetReturnCode(1); // added so BoundsChecker would not report use of uninitialized variable
this->Destroy();
} // CqueryDlg::OnCloseWindow() } // CqueryDlg::OnCloseWindow()