From: Vadim Zeitlin Date: Tue, 1 Mar 2005 10:19:24 +0000 (+0000) Subject: fix for crash when using wxEXEC_NODISABLE X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d60e233244ce3af5192815ddb6ffe9e17b07e75e fix for crash when using wxEXEC_NODISABLE git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32516 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 226677c279..fbeb00691f 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -888,14 +888,12 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) return pi.dwProcessId; } - wxAppTraits *traits = NULL; + wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; + wxCHECK_MSG( traits, -1, _T("no wxAppTraits in wxExecute()?") ); + void *cookie = NULL; if ( !(flags & wxEXEC_NODISABLE) ) { - if ( wxTheApp ) - traits = wxTheApp->GetTraits(); - wxCHECK_MSG( traits, -1, _T("no wxAppTraits in wxExecute()?") ); - // disable all app windows while waiting for the child process to finish cookie = traits->BeforeChildWaitLoop(); } @@ -916,8 +914,11 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) traits->AlwaysYield(); } - if ( traits ) + if ( !(flags & wxEXEC_NODISABLE) ) + { + // reenable disabled windows back traits->AfterChildWaitLoop(cookie); + } DWORD dwExitCode = data->dwExitCode; delete data;