X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..b3ecee8d120ac8af59cbf82b00d4c7da9f648f53:/samples/exec/exec.cpp?ds=sidebyside diff --git a/samples/exec/exec.cpp b/samples/exec/exec.cpp index ab63144a8e..fcbe8b3029 100644 --- a/samples/exec/exec.cpp +++ b/samples/exec/exec.cpp @@ -571,6 +571,8 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event)) return; } + m_pidLast = pid; + static const wxString signalNames[] = { wxT("Just test (SIGNONE)"), @@ -591,9 +593,11 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event)) wxT("Terminate (SIGTERM)"), }; + static int s_sigLast = wxSIGNONE; int sig = wxGetSingleChoiceIndex(wxT("How to kill the process?"), wxT("Exec question"), WXSIZEOF(signalNames), signalNames, + s_sigLast, this); switch ( sig ) { @@ -624,8 +628,11 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event)) break; } - if ( sig == 0 ) + s_sigLast = sig; + + if ( sig == wxSIGNONE ) { + // This simply calls Kill(wxSIGNONE) but using it is more convenient. if ( wxProcess::Exists(pid) ) { wxLogStatus(wxT("Process %ld is running."), pid); @@ -1370,8 +1377,7 @@ void MyPipeFrame::OnProcessTerm(wxProcessEvent& WXUNUSED(event)) { DoGet(); - delete m_process; - m_process = NULL; + wxDELETE(m_process); wxLogWarning(wxT("The other process has terminated, closing"));